What's up with bash shell and spaces in filenames?

Bill Davidsen davidsen at tmr.com
Mon May 10 20:25:58 UTC 2010


Alan Evans wrote:
> This is an on-again-off-again kind of problem. It usually hits me when
> it is least convenient, like when I only have shell access to the
> machine. Example:
> 
> [alan at agena ~]$ cd /media/My\ Book/
> bash: cd: /media/My: No such file or directory
> [alan at agena ~]$ cd "/media/My Book/"
> bash: cd: /media/My: No such file or directory
> [alan at agena ~]$ Gaaah!
> bash: Gaaah!: command not found
> 
Note that the last error is different, the "!" character has special meaning to 
bash, and even quotes don't keep it from being evaluated, although single quotes 
and backslash do.

In other words you have two separate issues here, the last one is no surprise.

-- 
Bill Davidsen <davidsen at tmr.com>
   "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot


More information about the users mailing list