[svlug] Working with spaces in shell scripts

Mike Castle dalgoda at gmail.com
Tue Dec 14 15:48:29 PST 2004


On Tue, 14 Dec 2004 15:15:15 -0800, Nathan <nathank at netflip.com> wrote:
> I want to remove the some files from inside a bunch of directories with
> spaces in the names. But when my script hits a directory with a space in
> its name the script will treat it as two separate directories (ie
> "Monkey Joe" becomes "Monkey" and "Joe"). Can this even be done with a
> shell script? Should I break down and use perl?

Quote the variable:

"$dir"

instead of:

$dir




More information about the svlug mailing list