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

Bill Davidsen davidsen at tmr.com
Mon May 10 20:21:57 UTC 2010


Chris Adams wrote:
> Once upon a time, Alan Evans <ame.fedora at gmail.com> said:
>> cd ()
>> {
>>        builtin cd $1 || return
>>        [[ -f ./.autorun ]] && . ./.autorun
>> }
> 
> Any shell functions should properly quote their arguments (and there are
> possibly arguments to cd, so you should pass all args, not just the
> first).  So:
> 
> cd ()
> {
>        builtin cd "$@" || return
>        [[ -f ./.autorun ]] && . ./.autorun
> }
> 

You still need to quote or escape the directory name, though. This should work 
even using any of the cd options.

Ha, you didn't know cd has options? ;-)

-- 
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