Re: OT: shell scripts and spaces in file/folder names
Vineet Kumar <debian-user@virtual.doorstop.net> writes:
> More to the point; bash expands the * in either case. When using
> `ls *`, the * is expanded into a file list which is passed to ls, which
> just spits back the same file list. It's a total waste.
There's actually a big difference here, since the OP asked about files
with spaces in their names. If I "touch 'foo bar'", then the shell
will break the output of `ls *` at the space, and I lose. zsh at
least seems to do the right thing for "for i in *".
mkdir temp
cd temp
touch 'foo bar'
for i in `ls *`; do echo "$i"; done
for i in *; echo echo "$i"; done
--
David Maze dmaze@debian.org http://people.debian.org/~dmaze/
"Theoretical politics is interesting. Politicking should be illegal."
-- Abra Mitchell
Reply to: