[CentOS] [OT] OSX-10.9.3 cd ~'/ problem with spaces'

Tue Jun 3 14:53:29 UTC 2014
James B. Byrne <byrnejb at harte-lyne.ca>

Apologies for this OT post.  I need some help debugging a bash script.  It
just happens to be provided by Apple Inc.

In a terminal session under OSX-10.9.3 I want do do this:

cd ~/'Library/Application Support'

Which is a simple enough request.  However, OSX returns: cd
/users/byrnejb/Library/Application: No such file or directory.  The space
evidently acts as a delimiter to cd even though the path is quoted.

However this:

ls -l ~/'Library/Application Support'

returns the directory contents without error.  Apparently ls is not affected.

I googled this off and on for the past two days and found nothing that works
for me.  All advice was to simply quote the path, which I was already doing
and which also did not work. I eventually fixed my problem by doing this:


builtin cd ~/'Library/Application Support'


It seems that OSX-10.9.3 implements 'cd' as an external script that contains
the following (Note the back-ticks surrounding the echo pipe tr commands):

#!/bin/sh
builtin `echo ${0##*/} | tr \[:upper:] \[:lower:]` ${1+"$@"}


My guess is that this is where the problem is but I cannot tell what it is. 
Can a bash virtuoso point out the syntax error that is causing this script to
mis-parse the path argument?  I just want to fix this so I do not need to
remember to use the builtin command when switching directories.  Sheer
laziness on my part.

Thanks

-- 
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3