> Thanks Christophe!

Salut,

> 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

Je comprends un peu le français :-) Bon comme l'as dit indigo6 tu peux
utiliser /etc/fstab pour le montage automatiqze des prériphériques,
mais bon scripter c'est sympa! Dans ce gner de situation ou tu a des
cas différents ben if y a 'case' c'est la manière la plus rapide de
traîter une informtion en programmation. ça devrait resembler à (ah
oui... unix philosophy: les options avec --


case $1 in
        --m)
                mkdir -p /media/disk
                mount /dev/sda1 /media/disk
                # On verifie si il a un second argument
                [ "$2" ] && cd /media/disk && ls -l ;;
        --u)
                umount /media/disk ;;
        --s)
                # Des stats!
                mount | grep ^/dev/[s][a-z]* ;;
esac

Si tu te déplace sousvent avec cd et veux vaire plus court, rajoute des
export dans tom ~/.profile, genre

clef=/media/myverylongpathtousbkeyinfrenchclef
export clef

Avec ça tu as toujours $clef dans ton environement et peux faire:

$ cd $clef

> 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


- Christophe

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

Reply via email to