hi, i have following lines in bash.
#!/bin/bash mount -t vfat /some/usb_devfs/device /mnt/usb cd /mnt/usb
But somehow the 'cd' command behaves very strangely. if after cd /mnt/usb i put 'pwd' it shows '/mnt/usb' but, instead of 'pwd' if i put 'ls' it shows the listing of dir from which the script is executed. very strange.
Harshal wrote:
Not too sure but I feel there should be a last line that exits you from the script.
Regards,
Rony.
___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
On Tue, Aug 30, 2005 at 08:29:16PM +0530, Rony Bill wrote:
No. There is no such line. If there is, it's not required.
On Mon, 2005-08-29 at 15:02 +0530, Harshal wrote:
$ cat bin/test.sh #!/bin/bash cd /mnt/sda; ls -a
I tested your script (a bit modified) and don't see the behaviour you describe. I executed the script from my $HOME which has many dirs and files.
ls -a shows . and .. (since /mnt/sda is empty) and pwd (replacing ls -a) shows /mnt/sda.
I tried this script in the following manner: *$cat test.sh* *#!/usr/bin/bash* *cd /opt* *pwd* *ls* When the script is executed, it gives the pwd as /opt and the ls lists the contents of /opt. But when I execute pwd from shell, it gives the directory from where I executed the script. Reason: The script is executed in a new shell. When it finishes the execution, the shell is killed automatically. Vidyadutt.
On 8/31/05, Vidyadutt S vidyadutt@gmail.com wrote:
i don't have any problem with pwd, in the script the pwd shows /mnt/usb, but if i put ls right after pwd in the script, it lists the files of dir from which the script is executed.
On 8/31/05, Vidyadutt S vidyadutt@gmail.com wrote:
suprising i can achive the same thing, with
mkdir ll cd ll who > who.txt pwd ls
but instead of 'mkdir ll' if i put the /some_devfs/usb_device, then that ls command won't work. still clueless.