[plug] rm of contents

Mike Holland myk at plug.linux.org.au
Mon Mar 17 16:43:05 WST 2003


On Mon, 17 Mar 2003, Matt Kemner wrote:

> On Mon, 17 Mar 2003, quoth Leon Brooks:
> 
> >
> > Almost. Try it with a filename that contains spaces, wildcards or brokets.
> 
> Use quotes to fix that

> <command> "$FILE"

But wont that just allow spaces? You can keep doing nasty hacks to catch
other exceptions, but the real problem is that bash does filename globbing
by default. If one *must* pass filenames through the bash (or any shell)  
command line in a script, you should turn off globbing. The '-f' option of
bash should do this.
  Personally, I think its time people stopped using shell languages for 
scripting, and use a more modern language thats actually *designed* for 
scripting, not interactive use. e.g. perl, tcl, python.
  The classic 'find|xargs' solution, of course, does not pass filenames on 
the shell command line, and so avoids the problem.

-- 
Ask not for whom the telephone bell tolls...
if thou art in the bathtub, it tolls for thee.



More information about the plug mailing list