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: alias command not effective


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

Attachment: signature.asc
Description: OpenPGP digital signature


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