From: Julien L. <ju...@fa...> - 2007-04-27 12:39:06
|
Keith MARSHALL wrote: > Group W wrote: >> I noticed that in a shell script the path: >> "C:/Documents and Settings/.../My Documents" >> >> is incorrectly being converted to: >> "C;<msys installation dir>/Documents and Settings/.../My Documents" >> > > It's a known bug, which only shows up occasionally, in particular > contexts; (what is it, in full, in your case, BTW). AFAIK, no fix > has yet been identified. > > FWIW, with MSYS-1.0.11, I see: > $ cmd //c echo "C:/Documents and Settings/keith/My Documents" > "C:/Documents and Settings/keith/My Documents" > > $ ls "C:/Documents and Settings/keith/My Documents" > My Pictures > > $ ls "C:/Documents and Settings/keith/My Documents/My Pictures" > Desktop.ini Sample.jpg > > but, in a context I know to be problematic: > > $ cmd //c echo "dir C:/Documents and Settings/keith/My Documents" > "dir C;D:\MSYS-1.0.11\Documents and Settings\keith\My Documents" > The builtin 'echo' of cmd.exe and bash behave differently: *cmd.exe:* > echo "Hello World" "Hello World" > echo Hello World Hello World *bash:* $ echo "Hello World" Hello World $ echo Hello World Hello World So in your first and last case; if you unquote the 'echo' passed to cmd; then you should get: $ cmd //c echo C:/Documents and Settings/Lecomte/Mes documents C:/Documents and Settings/Lecomte/Mes documents $ cmd //c echo dir C:/Documents and Settings/Lecomte/Mes documents dir C:/Documents and Settings/Lecomte/Mes documents I've hacked around the cmd shell script and got this to work with your 2 testcases: $(echo $COMSPEC | sed -e 's#\\#/#g') `echo "$@"` A couple explanations: - Using $(..) is because with backticks I get "sed: -e expression #2, char 7: Unterminated `s' command" - I've changed the sed because with the initial 's#\\\\#/#g' it doesn't convert the slashes. Is this deliberate? Am I missing something? - By issuing a backticked 'echo "$@"', we get the behavior of a cmd.exe 'echo. Julien |