This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygpath "$@" in a script: bug?


On Mon, 10 Mar 2003, Ralf Hauser wrote:

> in http://sources.redhat.com/ml/cygwin/2003-01/msg01707.html I thought to
> see how I should do this.
> The example works fine. But if I create a script that does
> the same
>
> echo "$@" | cygpath -w -f -
>
> and call it with
>
> testscript `/bin/ls /bin/ch*`
>
> I get
>
> C:\cygwin\bin\checkgid.exe \bin\chgrp.exe \bin\chmod.exe \bin\chown.exe
> \bin\chroot.exe
>
> is it possible that it chokes upon missing newlines (CR/LF)?

Yes, it needs the newlines (LF is enough, I think).
But if you have the arguments properly quoted already, why not
'for f in "$@"; do cygpath -w "$f"; done'?
	Igor

> Or even worse if I put in the long path:
>
> testscript `/bin/ls /cygdrive/c/cygwin/bin/ch*`
>
> cygpath: error converting "/cygdrive/c/cygwin/bin/checkgid.exe
> /cygdrive/c/cygwin/bin/chgrp.exe /cygdrive/c/cygwin/bin/chmod.exe
> /cygdrive/c/cygwin/bin/chown.exe /cygdrive/c/cygwin/bin/chroot.exe"
>
> or yet worse when I do that on my desktop with three test files a.txt,
> aa.txt and aaa.txt:
> rhauser at PC:/<3>rhauser/Desktop>
> testscript `ls /cygdrive/c/Docume~1/rhauser/Desktop/a*.txt`
> c:\Docume~1\rhauser\Desktop\a.txt
> \cygdrive\c\Docume~1\rhauser\Desktop\aa.txt
> \cygdrive\c\Docume~1\rhauser\Desktop\aaa.txt
>
> so the first path is converted properly while number 2 and 3 are wrong?
>
> Any thoughts?
>         Ralf

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha at cs dot nyu dot edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor at watson dot ibm dot com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]