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

Alan Evans ame.fedora at gmail.com
Mon May 10 15:37:18 UTC 2010


On Mon, May 10, 2010 at 8:31 AM, Mike Wright <mike.wright at mailinator.com> wrote:
> 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
>>
>> What's up with that? Usually it is no trouble, but occasionally, bash
>> refuses to deal with spaces. I don't even know what to do in this
>> case.
>
> You could use a "?" where the " " is.

Clever, but no:

[alan at agena ~]$ cd /media/My?Book/
bash: cd: /media/My: No such file or directory


More information about the users mailing list