shell script question
Erik Price
eprice at ptc.com
Mon Jan 20 08:38:08 EST 2003
Hi,
I am probably overlooking something obvious but it seems that when I try
to execute a command-line "for" loop, the "do command" part is not
executed from the current directory. Is that normal? Here is what I mean:
[erikprice at host:/home/erikprice]$ for i in `ls`; do "`which du` -khs
$i"; done
bash: /bin/du -khs bak: No such file or directory
bash: /bin/du -khs bin: No such file or directory
bash: /bin/du -khs cvs: No such file or directory
bash: /bin/du -khs dev: No such file or directory
bash: /bin/du -khs docs: No such file or directory
bash: /bin/du -khs down: No such file or directory
bash: /bin/du -khs ip-up: No such file or directory
bash: /bin/du -khs java: No such file or directory
bash: /bin/du -khs mail: No such file or directory
bash: /bin/du -khs pub: No such file or directory
bash: /bin/du -khs public_html: No such file or directory
bash: /bin/du -khs tmp: No such file or directory
As you can see in the above, I've had to put `which du` in the "do"
section (because for some reason the "du" command isn't found if I don't
specify an absolute path), and the filename arguments passed to the "do"
section aren't found. If I just type "du -khs bak" then it works fine.
My shell is bash 2.05 and I set my $PATH in ~/.bashrc (Gentoo Linux).
Thanks,
Erik
More information about the gnhlug-discuss
mailing list