Re: what is the difference?

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

 



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
> it executes the file but dont know the what it does if
> space is present between . and /)

This is a good question.  You will see the " . file " construct
used in lots of system shell scripts.

In effect the . causes the following file to be 'sourced' or read
as commands.   This permits a set of shell scripts to share
common functions, setup and configuration flags.  

Many of the scripts in /etc/init.d do this.  Read some of them...

The other form executes the file and returns and exit status (only
exit status and side effects impact the current shell).

The key difference is that the " . file" is executed by the current
shell and the second is executed by a sub shell and returns only
an exit status.

For csh users the keyword "source" is the equivalent to " . " for
sh and bash users.

I use the "dot" construct to setup my environment for some
projects.  Something like:

	. projX

Where projX contains lines like

        export PROJXPATH=$HOME/projX
	PATH=$PATH:$PROJXPATH/bin
	export BUILDPATH==$HOME/projX/src
	export PROJXFLAGS=" -j -fullwarn -kit -kabootal"
	pushd  $PROJXPATH
	export NAME=My-Proj-X-identity
	newrole -r projX_r   # see SELinux

The idea is to place all the junk that is project specific in one
place.  This keeps conflicts with other applications, projects and
tools (like projY) at a minimum.


-- 
	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