On Sun, 13 Jul 2003 11:05:41 +0100
David selby <debian@pusspaws.net> wrote:
I need to scan a directory for the file names contained in it.
for _scantox in $(ls $_tox); do
.....
done
Why use ls? Use the shell's globbing. IE, poor man's ls:
bash-2.05b$ echo *
Desktop Mail-sh News RCS ao bin dcc docs ebay files foo bar lyrics mail mw4
no_jeopardy noelle nofpfs perl_work program quicken_backup.rar signatures slrn
tscreen www www.old bash-2.05b$ echo Desktop/*
Desktop/Autostart Desktop/Templates Desktop/Trash
bash-2.05b$ for x in Desktop/*; do
echo $x
done
Desktop/Autostart
Desktop/Templates
Desktop/Trash
Of course the only problem above, at least with the echo line, is that
'foo bar' is really 'foo bar' and not 'foo' and 'bar'. IE:
bash-2.05b$ for x in f*; do
echo $x
done
files
foo bar