Mail Archives: cygwin/2005/02/20/14:48:03
Manipluating the result of cygpath -m with shell tools is needlessly
difficult.
$ pwd
/cygdrive/c/Program Files/Mozilla Firefox/defaults/profile
$ cygpath -m `pwd`/bookmarks.htm | sed 's} }%20}g; s}^}file:///}'
file:///c:/Program
file:///Files/Mozilla
file:///Firefox/defaults/profile/bookmarks.htm
$ cygpath -v
cygpath (cygwin) 1.36
Path Conversion Utility
Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
Compiled on Nov 10 2004
$ grep = /cygwin.bat
set CYGWIN=export ntsec ntea title
$
I can't find any documentation on this "feature" of cygpath, and do
not know if it is intentional and/or if it solves some other problem.
If this behavior is intentional, it should be documented.
[And, yes, I can work around this problem in a variety of ways.
For example
echo `pwd`/bookmarks.htm | sed 's}/cygdrive/c}file:///c:}; s} }%20}g;'
works just fine. I can also pipe the output of cygpath through xargs
echo. I can even write myself a shell script which will grab leading
option arguments and then iterate over all non-option arguments,
sticking `pwd` in front of each one that's not absolute and running
cygwin individually on all of those, wrapping cygwin's output in echo
and spitting the results out one per line (which would make cygpath
useful with wildcards, and fit the standard pattern for unix commands).
Of course all of these things could, at least in principle, be done in
the executable itself, too... which would eventually be easier to deal
with when I hop on random windows systems. But perhaps someone thinks
the current awkward behavior was a good idea?]
Thanks,
--
Raul
--
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/
- Raw text -