delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/01/17/10:13:50

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4D344C60.2000608@redhat.com>
References: <ih0u79$44j$1 AT dough DOT gmane DOT org> <4D344C60 DOT 2000608 AT redhat DOT com>
From: Julio Costa <costaju AT gmail DOT com>
Date: Mon, 17 Jan 2011 15:13:17 +0000
Message-ID: <AANLkTikkDMd=yxt+CRx7i3gcOZ-U5H8CKgw+ymnybny6@mail.gmail.com>
Subject: Re: alias command not effective
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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.
> >
> > =C2=A0alias laf=3D'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=3D'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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019