To display current directory I am using $pwd
which is working fine in Cygwin.
This document is explaining how to convert cygwin directory to windows format. But why $cygpath -w pwd
and $cygpath -w $pwd
is not working?
It is what I am getting in that case:
try any of these versions:
cygpath -w "$(pwd)"
cygpath -w "$PWD"
cygpath -w "`pwd`"
I didn't want to remember cygpath - so i created a wrapper around pwd and added to my .bashrc
pwd()
{
if [[ $1 == "-W" ]] ; then
cygpath -aw .;
else
wpwd="-W, --winpath\t Gives you actual Windoze path"
err_msg=$(/usr/bin/pwd $* 2>&1);
let "v = $?"
if [ $v -eq 1 ] ; then # have error
echo "${err_msg}" | sed 's/.*pwd --help.*//' ;
/usr/bin/pwd --help | sed "s|\(.* -L, --logi.*\)| $wpwd\n\1|"
else
echo "${err_msg}"
fi
fi
}
`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With