error in bash's cd command

Glen Coakley gcoakley@mqsoftware.com
Wed Mar 28 16:09:00 GMT 2001


[administrator@GCP36W2K /]$ cd  "/d/cygwin/usr/local/bin "
                             ### Why does this work with the space in there?
[administrator@GCP36W2K /d/.../usr/local/bin]$ echo "'`pwd`'"
'/d/cygwin/usr/local/bin '   ### Note: there is a trailing space in the path
[administrator@GCP36W2K /d/.../usr/local/bin]$ ls
                             ### ls cannot find any files
[administrator@GCP36W2K /d/.../usr/local/bin]$ cd `pwd`
[administrator@GCP36W2K /d/.../usr/local/bin]$ ls
bc.exe*  cygwin_indir.bat*  echoping.exe*
[administrator@GCP36W2K /d/.../usr/local/bin]$


I noticed this problem because I wanted to set up a right-click action in
the shell similar to the "Command Prompt Here" power toy that you get from
Microsoft. So, I edit the Registry to call a DOS batch file passing it the
current directory name. The batch file converted that to a Unix path that
Cygwin bash could use and output that to a file. Then when the bash shell
starts it checks for that file and changes to the directory in it (if it
exists). Unfortunately, Windows 2000 puts a trailing space in the "%1" that
is passed from a right click-invoke command on file operation, even though I
have it double-quoted. I am guessing that ls is passing a directory path
ending with a space to opendir() which fails. 


 <<cygnus_info>> 
________________________________
Glen Coakley, Sr. Software Engineer
MQSoftware Inc., (763) 543-4845
Have you ever wonder what happens when you run "rm -rf / " but been afraid
to try it?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygnus_info
Type: text/x-algol68
Size: 9538 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20010328/8d2e5a9c/attachment.bin>


More information about the Cygwin mailing list