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

Thu Jun 5 13:18:53 UTC 2014
James B. Byrne <byrnejb at harte-lyne.ca>

I get the digest version fo this list so I apologise for any discontinuity to
my reply posts introduced thereby.

On Wed, June 4, 2014 15:36, Herta Van den Eynde wrote:
> No OSX here either, but just to be sure, could you publish the results of:
>
>   which cd; echo $?
>   locate cd | grep '/cd'$; echo $?
>   ls -ldb ~/Library/Application*
>

$(which cd) returns /usr/bin/cd and that file contains the script I displayed
yesterday.  I do not have my MBP here at work today so I cannot obtain the
other informations you desire.

In any case, once the reference to aliases twigged my memory I tested for the
problem with other accounts and discovered that the issue existed only for my
development user id.  That brought to mind that I once had RVM installed on
that account. Further, I recalled I once had run into a bug with an early
development version of RVM due to it overriding cd in a shell function, which
is not an alias but is similar enough for most purposes.  I cannot recall what
that issue was but at least the memory of it put me on the right track.

So I grepped for CD in ~/\.* and found an RVM related cd function in
.bash_profile which did not escape $1.  I changed that reference to "$1" and
the problem was thereby fixed.

Thanks for all the help and suggestions.

I do have a few residual questions however:

1. What does the 1+ in the shell expansion ${1+"$@"} mean and do?

2. I know that $0 returns the shell name or shell script file name.  How does
${0##*/} differ in effect from $0.

3. Why is ${0##*/} used instead of $0 or ${0} in this case?



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