public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: Using cygpath with backticks
  2013-06-22 15:58 Using cygpath with backticks Matt D.
@ 2013-06-22 15:58 ` Andrew DeFaria
  2013-06-23  7:34   ` Matt D.
  2013-06-22 17:03 ` Earnie Boyd
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew DeFaria @ 2013-06-22 15:58 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Using cygpath with backticks
@ 2013-06-22 15:58 Matt D.
  2013-06-22 15:58 ` Andrew DeFaria
  2013-06-22 17:03 ` Earnie Boyd
  0 siblings, 2 replies; 4+ messages in thread
From: Matt D. @ 2013-06-22 15:58 UTC (permalink / raw)
  To: cygwin

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.


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using cygpath with backticks
  2013-06-22 15:58 Using cygpath with backticks Matt D.
  2013-06-22 15:58 ` Andrew DeFaria
@ 2013-06-22 17:03 ` Earnie Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Earnie Boyd @ 2013-06-22 17:03 UTC (permalink / raw)
  To: cygwin

On Sat, Jun 22, 2013 at 11: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 "$@"`'

I think all you want is

alias pathw='cygpath -w'

> pathw "/cygdrive/g/"
>

The result of this will then be

G:\

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using cygpath with backticks
  2013-06-22 15:58 ` Andrew DeFaria
@ 2013-06-23  7:34   ` Matt D.
  0 siblings, 0 replies; 4+ messages in thread
From: Matt D. @ 2013-06-23  7:34 UTC (permalink / raw)
  To: cygwin

The test case I provided was a simplified version of what I intend to 
use it for.

Andrew is correct in that '$@' is not evaluated in the context of an 
alias and I would need to wrap up my intended alias in a function.

Thanks. I was having a brain fart there.


On 6/22/2013 11:58 AM, Andrew DeFaria wrote:
> 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:\
> $

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-23  3:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-22 15:58 Using cygpath with backticks Matt D.
2013-06-22 15:58 ` Andrew DeFaria
2013-06-23  7:34   ` Matt D.
2013-06-22 17:03 ` Earnie Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).