On 4/27/05, Binand Sethumadhavan <[EMAIL PROTECTED]> wrote:
> On 27/04/05, Logu <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > What is the difference between invoking a bash shell script with "source
> > ./scriptname" and ". ./scriptname".  I thought both are same (to invoke the
> > script in current shell). But when there is an exit statement, when the
> > script is invoked with "source  ./scriptname" exits the current shell where
> > as the ". ./scriptname" did not.
> 
> You sure? Both versions exits the current shell for me.
> 
> Binand
When you execute it as ./scriptname , the script runs under a
subshell. So when it runs the exit statement, it exits the subshell.
Whereas when you run as source ./scriptname, it runs  under the
current shell and therefore it exits the current shell.

Thanks
- Tusar


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id5hix
_______________________________________________
linux-india-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to