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 Mon, Jan 17, 2011 at 14:04, Eric Blake wrote:
>
> 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.
>

And, using my "paranormal powers", I'd say the command line the OP wants is:

alias laf='ls -la | grep -v "^d"'

(note the second quote char was moved to the end)

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

He never wanted to pipe the alias command :)
The real answer is: Double-check the quoting rules, so that pipe char
doesn't get interpreted by bash.

> This is not cygwin-specific.
>

ditto.

___________
Julio Costa

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