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 22:42:44 +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=J7yWdlogHXKYn+4R2P3ztQWdZxAlJOP1+6KFP+NZ8/A=; b=cbW+t3x73lDR+psRQcV5jOwCgIi4zQGWM+9BYeeHiOdWdnDfgz7YPRr/NshrIoRct9 3HpME+zODKlyEu6rO9bo37+C0HX5WxYqlAUBHLWUmR1E5kA3yICVOlpQ1g4DbKTZmCd/ UpIvJXrSlA/Ur930EP2kjAeNgZ10hSghJ3yh8=
- 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=rplvTctqCovL+9V3fb3BVy9IuHngH5mUFUk58m1JOUMze6Wvi6Lt0gn7Z25ng8EHJx Q8P3ixw9XRdrQ+L7Q4JCHnaLNLEbajA3UajdREuCIrp5ytZVnlZ8S3CnjRON3zip789S x7zSdsIyheH16q9p+og8yw4mlIkHnb/JfUGuU=
Ok, two things:
1) If you didn't understand using cd in a script, it's like this - from /etc
#!/bin/sh
#example
cd /
echo "test" > file.txt
exit 0
-- you'll find yourself back in /etc, but there will be file.txt in /
2) If you want to mount your usb key automatically, I think you don't
need a script --
just add it to /etc/fstab using disk-by-uuid and it should automount
@pansko I promise I will edit the tazpanel README over the weekend.
I'm sorry it's taken so long, but the rest of my life has been crazy
(surely you understand that) -- I did get the chance to compile and
test tazpanel and I love it. It really adds another dimension to the
possibilities of Slitaz... but more on that, later. I have a few
ideas and a few questions, and will compose them in the next few days.
On Fri, Apr 15, 2011 at 9:01 PM, seb <sebastiencharpentier@xxxxxxxxxxx> wrote:
>
> 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/
>
>
---
SliTaz GNU/Linux Mailing list - http://www.slitaz.org/