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
On Tue, Jun 03, 2014, James B. Byrne wrote:>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'Works for me on my OS X 10.8.5 Macbook Pro, xterm under xQuartz and under the Terminal.app.>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'Perhaps you have 'cd' as an alias or a function which loses the quotes when passing to the real cd? Bill -- INTERNET: bill at celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax: (206) 232-9186 Skype: jwccsllc (206) 855-5792 For every subtle and complicated question, there is a perfectly simple and straightforward answer, which is wrong. -- H. L. Mencken
On Tue, 3 Jun 2014, James B. Byrne wrote:> 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'Try cd "${HOME}/Library/Application Support/" -- Paul Heinlein heinlein at madboa.com 45?38' N, 122?6' W