cc: gsf at research.att.com
Subject: Re: [shell-discuss] Fwd: ksh93 in os200811 bug or feature ?
--------


> ---------------------------- Original Message ----------------------------
> Subject: ksh93 in os200811 bug or feature ?
> From:    "Dennis Clarke" <dclarke at blastwave.org>
> Date:    Tue, December 9, 2008 09:08
> To:      shell-discuss at opensolaris.org
> --------------------------------------------------------------------------
> 
> 
> I can not tell if this is expected behavior or a bug.
> 
> On my desktop I created a folder ( this is really a directory in
> $HOME/Desktop and why do we call them folders? For Mac people? ) called
> "My Docs" ( without the quotes ) and then took a screenshot and saved it
> in there.
> 
> I opened a terminal.
> 
> I use /bin/ksh93 as my default shell.
> 
> I cd Desktop
> 
> $ cd Desktop/
> $ ls -lap
> total 15
> drwxr-xr-x  3 dclarke csw    7 2008-12-09 08:37 ./
> drwxr-xr-x 24 dclarke csw   36 2008-12-09 08:56 ../
> -rw-r--r--  1 dclarke csw 3025 2008-12-09 08:33 addmoresoftware.desktop
> drwxr-xr-x  3 dclarke csw    4 2008-12-09 08:47 My Docs/
> -rw-r--r--  1 dclarke csw 1786 2008-12-09 08:33
> opensolaris-next-steps.desktop
> -rw-r--r--  1 dclarke csw    0 2008-12-09 08:33 .os-icons-installed
> -rw-r--r--  1 dclarke csw 1714 2008-12-09 08:33 register-opensolaris.desktop
> 
> I then figure I'll take advantage of tab completion and cd into that
> directory "My Docs". I type the letters "cd" followed by a capital "M" and
> hit tab, this is what I get :
> 
> $ cd 'My Docs/
> 
> So I hit enter and get :
> 
> $ cd 'My Docs/
> >
> 
> Not exactly expected behavior.
> 
> Hitting enter does not help at this point as I simply get another ">" char
> on a newline.  A CTRL-C stops this and I get my "$" prompt back and I am
> in the same directory. Looks like I need to add the single quote char to
> get what I want ?
> 
> $ cd 'My Docs/'
> $ pwd
> /export/home/dclarke/Desktop/My Docs
> 
> Yes. That works,
> 
> Perhaps the space char is the issue here ?
> 
> Let's try an experiment.
> 
> $ cd ..
> $ mkdir foo
> $ cd foo/   <--- I type the char "f" here, and hit tab, and then enter
> $ pwd
> /export/home/dclarke/Desktop/foo
> $
> 
> perfect.
> 
> Let's try again but with a space char in there now.
> 
> $ cd ..
> $ rmdir foo
> $ mkdir foo\ bar
> 
> I now type "cd fo" and hit tab to see this :
> 
> $ cd 'foo bar/
> 
> Then hit enter :
> 
> $ cd 'foo bar/
> >
> 
> 
> Hit CTRL-C and then see that I do need to add that trailing single quote
> char myself.
> 
> $ cd 'foo bar/'
> $ pwd
> /export/home/dclarke/Desktop/foo bar
> 
> feels like a bug but this may be part of some parseing process that
> intercepts or traps based on some possible sneaky char in the string on
> the command line. If I am wandering lost in the desert again and simply
> don't know what I am talking about ( again ) then just say so.
> 
> Dennis
> 
> 
> _______________________________________________
> shell-discuss mailing list
> shell-discuss at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/shell-discuss
> 

Since the file has a space in it, ksh quotes the while name. However,
since this is a directory, it places a / at the end and omits
the trailing ' because it expects that you will type another
component of the name.  It doesn't know that it is expecting
a directory rather than a file.

Thus, you need to type the trailing '.

However, I will rethink this and might change this to a more intuitive
behavior.

David Korn
dgk at research.att.com

Reply via email to