alias command not effective

Eric Blake eblake@redhat.com
Mon Jan 17 19:28:00 GMT 2011


On 01/17/2011 01:24 AM, Thomas Wiedmann wrote:
> Hello,
> 
> After defining an alias, e. g.
> 
>  alias laf='ls -la' | grep -v "^d"

That defined an alias in the subshell used to form the pipeline.
Aliases in child processes do not affect the parent process.

> laf
> bash:: laf: command not found

Because the parent process still doesn't have an alias defined.

> 
> What may be the reason, that the use of an alias, defined, had not been
> accepted?
> What has to be done to resolve this problem?

Don't pipe the output of alias into another command, thereby avoiding
the subshell that would limit the alias to just the child shell.

This is not cygwin-specific.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20110117/08fc7582/attachment.sig>


More information about the Cygwin mailing list