This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using cygpath with backticks


On 06/22/2013 08:39 AM, Matt D. wrote:
Maybe I've just had a long week but I can't seem to get this to work:

alias pathw='echo `cygpath -w "$@"`'
pathw "/cygdrive/g/"

I also tried:

alias pathw='echo $(cygpath -w "$@")'

cygpath just yells at me that I'm doing something wrong.
Try a real function:

$ function pathw {
> echo $(cygpath -w "$@")
> }
$ pathw /cygdrive/c
C:\
$

I don't think that $@ is evaluated in the context of an alias.

However, if all you are doing is echoing out the Windows path for a posix path then that's already what cygpath does. And the following also would work:

$ alias pathw='cygpath -w'
$ pathw /cygdrive/c
C:\
$
--
Andrew DeFaria <http://defaria.com>
Cranial-rectal inversion disorder - a condition where one's head is where one's butt should be and vice-versa, causing an otherwise sensible person to make an ass of himself.


--
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]