in reply to Re^2: true from (-e "") on Windoze
in thread true from (-e "") on Windoze

Ya, I didn't catch that they were quotes within quotes. Out of curiosity, why/how is that happening?

Replies are listed 'Best First'.
Re^4: true from (-e "") on Windoze
by CarolinaPerler (Acolyte) on Jul 02, 2012 at 19:31 UTC
    My code is being fed, so to speak, by another application over which I have no control. Every now and again, when the feeder is asked for a list of files, it returns one or more elements in the array that contains just a pair of empty double quotes.

    Oddly, at a Windows command prompt, you can do 'cd ""' and it does not complain. It doesn't go anywhere, but, it doesn't complain.
      Oddly, at a Windows command prompt, you can do 'cd ""' and it does not complain. It doesn't go anywhere, but, it doesn't complain.

      Don't assume cmd.exe (or command.com) behave like a unix shell. Quite the opposite is true. 30 years of bug-compatible extensions give both a very unique smell. Whatever happens in those two dinosaurs has nearly nothing in common with the underlying APIs.

      Note that unquoting happens inside the application, not in the shell -- except when you call a shell buildin like cd/chdir. Now look at the fine differences:

      Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\alex>cd C:\Users\alex C:\Users\alex>cd "" C:\Users\alex C:\Users\alex>cd . C:\Users\alex>

      cd "" behaves like cd without arguments, i.e. it prints the current directory. cd . actually changes the current directory to *drumroll* the current directory! So it does not print anything.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)