Re: I cannot use the 'cd' command in a script |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/slitaz Archives
]
- To: slitaz@xxxxxxxxxxxxxxxxxxx
- Subject: Re: I cannot use the 'cd' command in a script
- From: Indigo <pointofavailability@xxxxxxxxx>
- Date: Fri, 15 Apr 2011 23:29:42 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=pVc2bbWYjgWr2Xgat52+QLF/0KaSmITapAV+30p18+o=; b=p8NX91ahUtt+WqTrGyBvTyzfsGba/SMjKsbE0/wvw3U2AaNgPAPUP7hg7qPOt24Syx 3rrEKCB+QRRLonhCO3kQ854Wuyg39T6iZsdmE31it3AiEuD1dIbtLsFM3UAaTz4aNz7B tzO6t3aqxPwcJsIEYruLLJKs2lYJqkCYYKYks=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=jUy4StqDfxMXsXkMpJm0hZ312WwuMKPLnorXsBVTH6JqYSRGS/P0YVsloAj+1zZtSw ONuM+Wfvc+DUmRlF1BdfPg6VohmPseqxr+w+rqBTGcX0z/mYljanCekmqKp02hDY+xfW ml3dzJZQlX8Gz+LtYtJY/n5H8sbHePD1FSlmY=
I didn't think about udev - is that helpful here?
and - myverylongpathtousbkeyinfrenchclef <---- that's really funny
On Fri, Apr 15, 2011 at 11:21 PM, Christophe Lincoln <pankso@xxxxxxxxxx> wrote:
>
>> 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/
>
>
---
SliTaz GNU/Linux Mailing list - http://www.slitaz.org/