Here is a start. "t" is the parser, "tt" tests how it works. Depending on exactly what you are doing, you may have to play with the quotes, or it may be impossible to handle quotes correctly in the shell alone.
/c> cat t #!/bin/sh for Arg in "$@" do if test -f "${Arg}" -o -d "${Arg}" then NewArgs="${NewArgs} '$(cygpath -w "${Arg}")'" else NewArgs="${NewArgs} '${Arg}'" fi done echo NewArgs="${NewArgs}" echo no eval, no quote tt ${NewArgs} echo no eval, quote tt "${NewArgs}" echo eval, no quote eval tt ${NewArgs} echo eval, quote eval tt "${NewArgs}" /c> cat tt #!/bin/sh for A in "$@" do echo "$A" done | cat -n /c> t 123 /c/cygwin/bin/ls.exe '45 67' /c/Program\ Files/Mozilla/Firefox/firefox.exe /c/Program\ Files NewArgs= '123' 'c:\cygwin\bin\ls.exe' '45 67' 'c:\Program Files\Mozilla\Firefox\firefox.exe' 'c:\Program Files' no eval, no quote 1 '123' 2 'c:\cygwin\bin\ls.exe' 3 '45 4 67' 5 'c:\Program 6 Files\Mozilla\Firefox\firefox.exe' 7 'c:\Program 8 Files' no eval, quote 1 '123' 'c:\cygwin\bin\ls.exe' '45 67' 'c:\Program Files\Mozilla\Firefox\firefox.exe' 'c:\Program Files' eval, no quote 1 123 2 c:\cygwin\bin\ls.exe 3 45 67 4 c:\Program Files\Mozilla\Firefox\firefox.exe 5 c:\Program Files eval, quote 1 123 2 c:\cygwin\bin\ls.exe 3 45 67 4 c:\Program Files\Mozilla\Firefox\firefox.exe 5 c:\Program Files -----Original Message----- From: Karr, David Sent: Friday, June 04, 2004 11:41 AM To: Cygwin Subject: Strategy to process all tokens on a line through "cygpath -w", ignoring non-path tokens I have a situation where I have a command line that I need to preprocess with "cygpath -w", changing all tokens which represent paths to convert them to their windows equivalent. All other tokens should pass through unchanged. Is there already a canned solution for this? What would be a reasonable strategy to get this done? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/