public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Aliases - I learned something new
@ 2017-08-25 15:00 cyg Simple
  2017-08-25 15:20 ` Eric Blake
  0 siblings, 1 reply; 2+ messages in thread
From: cyg Simple @ 2017-08-25 15:00 UTC (permalink / raw)
  To: cygwin

In the research for my responses to the alias issue I learned something
I didn't know. Not a big deal but I thought I would share.

If the value of an alias ends in a space the word following the issuance
of the alias command is also checked for alias expansion.  Example:

$ alias t1='echo abc'
$ alias t2='dev'
$ t1 t2
abc t2

$ alias t1='echo abc '
$ t1 t2
abc def

-- 
cyg Simple

P.S. I love learning new things, it just proves my wife's assumption
that I don't know everything. ;p

--
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] 2+ messages in thread

* Re: Aliases - I learned something new
  2017-08-25 15:00 Aliases - I learned something new cyg Simple
@ 2017-08-25 15:20 ` Eric Blake
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2017-08-25 15:20 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1: Type: text/plain, Size: 694 bytes --]

On 08/25/2017 10:00 AM, cyg Simple wrote:
> If the value of an alias ends in a space the word following the issuance
> of the alias command is also checked for alias expansion.

In fact, this behavior is POSIX-mandated, so that you can do things like:

alias exec='exec '

and get alias expansion on 'foo' when you do 'exec foo'

>  Example:
> 
> $ alias t1='echo abc'
> $ alias t2='dev'
> $ t1 t2
> abc t2
> 
> $ alias t1='echo abc '
> $ t1 t2
> abc def

Doesn't quite match what you typed above (dev vs. def), but illustrates
the point.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

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

end of thread, other threads:[~2017-08-25 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 15:00 Aliases - I learned something new cyg Simple
2017-08-25 15:20 ` Eric Blake

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