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

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


Thanks Christophe!

What i want to do is to modify one of my script:
this script mount or umount a USB key or disk with this syntax :

clef $1 $2   (clef means key in french)

where $1 can be 'm' for mount or 'u' for umount
and   $2 can be 'g' for "going" in the key

so if i plug a key and then send a :

clef m g

the script mounts the key in /mnt and then it has to go in it with a
cd /mnt
but when exiting, it brings me back where i was at the beginning.

This is not a big issue but it is boring cause i use key all the time.
I hope not to pollute the mailing list with my user problem (this is
certainly not a bug if i understood).

Thanks




Le Fri, 15 Apr 2011 22:45:21 +0200,
Christophe Lincoln <pankso@xxxxxxxxxx> a écrit :

> 
> 
> > Hey!
> 
> Hi,
> 
> > Thanks for your answer.
> > Do you know how i can change the current directory with a script ?
> 
> What do you want to do exactly, if you save tese line and run the
> script:
> 
> =================================
> #!/bin/sh
> #
> 
> mkdir tmp
> cd tmp
> touch file
> 
> exit 0
> =================================
> 
> Here it creat a tmp directory and the a empty file in it! If you not
> sure with cd and paths, use variable in your scripts:
> 
> FILE="file.txt"
> DEST="/home/slitaz"
> 
> cp -f $FILE $DEST
> 
> 
> - Christophe
> 
> ---
> 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/