Casey Bralla on 26 Jan 2013 13:13:46 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Strange Bash Behavior vis-a-vis Embedded Spaces

I recently tried to do a file deletion and got some strange results.

If I did this command:

rm "/directory with spaces/filename" (with quotes around the full path and file 
name) the command would error out with a file-not-found error.

However, this command works just fine:

rm /directory\ with\ spaces/filename

I thought quoting the filename would work, but I had to escape the spaces to 
make it work.  I find the escape method to be difficult to read, while the quoted 
string is very easy.  Hence, I always use the quoted method.  

Can anybody explain why the quoted string does not work?  

Casey Bralla

Chief Nerd in Residence
The NerdWorld Organisation
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --