[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ilugc
Subject:    Re: [Ilugc] use ~ for users home dirs
From:       Girish Venkatachalam <girishvenkatachalam () gmail ! com>
Date:       2009-10-30 8:51:55
Message-ID: 7938ae610910300150v7baaf4c8j5c3425306484eadd () mail ! gmail ! com
[Download RAW message or body]

On Fri, Oct 30, 2009 at 12:19 PM, Govi <govi.lin@gmail.com> wrote:
> Hi Friends,
>
> I am using ~ symbol for before username  on users home directories.
>
> e.g
> ls ~user1/ instead of  ls /home/user1
>

Okay.

> i want to know which one is the configuration file specified "~" sysbol
>

On the top left corner of the keyboard below 'ESC' key. You have to press shift
and that key to get tilde(~).

> also i want to use
> ls user1 instead of ls ~user1
>
> can anybody have idea??


Actually tilde expansion is implemented by the glob(3) function.I will
talk about
this in the weekly language classes in the coming weeks. I wan to speak
about a lot of related functions and many interesting programming features that
we use day in day out but don't actually realize.

You will be interested in reading the man pages of

glob(3)
fnmatch(3)
regcomp(3) and regex(3)

I plan to write an article on C programming with this in a little
while(around 10 days
or more ;).

Now to answer your question you can use cd $HOME if you don't like tilde(~). ;)

Do a

$ echo $HOME

or for that user, do a su of that user and then type $HOME.

~user is actually a different matter. ;)

-Girish

I have attached my glob.c test program which I will explain in the language
classes but check it out. ;)


#include <stdio.h>
#include <glob.h>
#include <stdlib.h>

int
main()
{
        glob_t pglob;
        int gflags, gerr, i;
        char *filename;

        gflags = GLOB_MARK | GLOB_TILDE;

        gerr = glob("~/C/*.c", gflags, NULL, &pglob);
        if (gerr)
                exit(128);
        for(i=0; i<pglob.gl_pathc; ++i) {
                filename = pglob.gl_pathv[i];
                printf(filename);
                printf("\n");
        }

}

-- 
Gayatri Hitech
web: http://gayatri-hitech.com

SpamCheetah Spam filter:
http://spam-cheetah.com
_______________________________________________
To unsubscribe, email ilugc-request@ae.iitm.ac.in with 
"unsubscribe <password> <address>"
in the subject or body of the message.  
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic