Re: what is the difference?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 08, 2004 at 11:57:04AM +0200, Björn Persson wrote:
> Nifty Hat Mitch wrote:
> 
> >On Fri, Sep 03, 2004 at 06:14:56PM -0700, Deepak Oberoi wrote:
> >
> >>what is the differecne between the following?
> >>. /etc/sysconfig/sendmail
> >>and
> >>./etc/... (i know if the "." is followed by "/" then
> >
> >This is a good question.  You will see the " . file " construct
> >used in lots of system shell scripts.
....

> Note that the "./directory/file" syntax isn't only used in shell 
> scripts. Nor is it specifically for executing programs. It's simply a 
> way to reference a file relative to the current directory. "." is the 
> current directory, "./file" is a file in the current directory, and 
> "./directory/file" is a file in a subdirectory of the current directory.

Absolutly.  The concept of . as the current or present working
directory is a critical one.  See the man page for pwd.  New users to
Linux and Unix should note the importance of two special links for
directories ( . and .. ).  Note that these are standard and special
links (references) to a specific inode.  Dot and DotDot make it
possible to move about in the directory tree of the filesystem.

    $ mkdir one
    $ls -lia
    total 60
    493624 drwxrwxr-x   3 bob bob   4096   Sep  8 11:15 .
    212993 drwxrwxrwt  20 root root  40960 Sep  8 11:14 ..
    493625 drwxrwxr-x   2 bob bob   4096   Sep  8 11:15 one
    $ cd one
    $ ls -lia
    total 16
    493625 drwxrwxr-x  2 bob bob 4096 Sep  8 11:15 .
    493624 drwxrwxr-x  3 bob bob 4096 Sep  8 11:15 ..

This is an IMPORTANT and fundimental concept. I am glad that Björn
reminded me how important it it.

Recommended reading "The UNIX Programming Environment, Kernighan and Pike"


-- 
	T o m  M i t c h e l l 
	Just say no to 74LS73 in 2004



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux