From: Keith M. <kei...@us...> - 2012-11-12 08:22:59
|
On 12/11/12 02:39, Renato Silva wrote: > A small improvement: > > $ winpath(){ cmd //c @echo off \&\& echo "$@"; } > $ winpath /mingw/bin > C:/Programs/Desenvolvimento/MinGW/bin How is this obfuscation an "improvement"? The "@echo off" is completely unnecessary; (it is useful only within a cmd batch file, which this bash shell function is not). Since you don't need the "@echo off", neither do you need the ugly escaped ampersands. Even if you do have a weird system configuration, which results in cmd.exe echoing the command given with "cmd //c" $ winpath(){ cmd //c @echo "$@"; } should suppress it. BTW, the variant using "pwd -W" can be expressed succinctly as: $ winpath(){ ( cd "$1" && pwd -W ); } but remains inferior, since it will work only for path names which represent an existing *directory*, whereas the cmd variant works with any MSYS path name, directory or file, or even non-existent. -- Regards, Keith. |