Re: I cannot use the 'cd' command in a script

[ Thread Index | Date Index | More lists.tuxfamily.org/slitaz Archives ]


Yes!!

Thanks Klaus, i was use with the ./script for the "non in path scripts"
but i didn't know about this other .

this is pretty cool, i have got what i wanted for that specific need!
:)


Le Sat, 16 Apr 2011 15:01:48 +0200,
Klaus Klein <k.klein@xxxxxx> a écrit :

> 
> Am 15.04.2011 18:19, schrieb seb:
> > Hey!
> > When using the 'cd' command in a script it has no impact on the
> > current shell :
> That's by design.
> 
> If you execute a script, then this usually happens in it's own
> sub-shell which has it's own environment. Any modification done to
> the environment therefore applies only to environment of the
> sub-shell and not the one you started the script in.
> 
> If you want the script executed in the current shell you need to call
> the script with a '.' in front.
> 
> E.g. ':~# . /etc/script.sh' instead of ':~# /etc/script.sh'
> 
> Thereafter you should be in the directory you cd'd into.
> 
> Rgds.,
> Klaus
> 
> ---
> SliTaz GNU/Linux Mailing list - http://www.slitaz.org/
> 
> 



---
SliTaz GNU/Linux Mailing list - http://www.slitaz.org/


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/