This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: $USER is not resolved in paths sometimes
Sorry, I copied all examples with the -w option which is wrong for converting into a unix like pathname.
To convert to a unix pathname use the option -u
to convert to a windows pathname use -w
Run: cygpath --help
for more detals. and to get the output in the sell use $(...) or the ticks `....`
with the command and all arguments inside.
>
> I agree with Achim. Don't use Microsoft Windows paths.
> Cygwin has a function called cygpath which is very handy to use to convert paths and use in zsh and other shell scripts
>
> In zsh, using zsh syntax, I use it like this:
>
> Convert the first argument to a micrsoft window format pathname
> winpath=$(cygpath -w $1)
>
> or to convert a Windows formatted pathname to unix like do:
> fname=$(cygpath -w ${windows-type-ifname})
>
> a hardcoded filename would be
> fname=$(cygpath -w ${C:\miscrosoft\windows-type-ifname.abc})
>
> * you may need to quote the flename to escape : or \....
>
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple