delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/01/17/09:04:35

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4D344C60.2000608@redhat.com>
Date: Mon, 17 Jan 2011 07:04:16 -0700
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, th DOT wm AT gmx DOT de
Subject: Re: alias command not effective
References: <ih0u79$44j$1 AT dough DOT gmane DOT org>
In-Reply-To: <ih0u79$44j$1@dough.gmane.org>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

--------------enigA56E933F3146F8FF26805438
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 01/17/2011 01:24 AM, Thomas Wiedmann wrote:
> Hello,
>=20
> After defining an alias, e. g.
>=20
>  alias 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.

> laf
> bash:: laf: command not found

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

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

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


--------------enigA56E933F3146F8FF26805438
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJNNExlAAoJEKeha0olJ0Nqs7AH/3C1PPA5zY3MiwwiNNk/9VKZ
QBE9lIcOB7czUJ45hD+cF1bRT8Bgx1xnBsXmkmIIhNqJ2EX7OJHbqw4a7rPX0Di0
z35RFub5amMYN1gKC9Mur3Qy5JJg1MHUojXKPTd0vtLjmICe50KkmwxUw4WR5ISU
DJJWwkID1SYz2vro3bIFmC9t+lH0RABbq4+urknX87fA6FglCB15TWDeTeBq800J
c8lcGUGWoDJQYSkaBt8NSdZPPEN8lbHo4+2N+Qu9ggXtW+HGXFSWCpuRqkFYm6Ag
tttLx4Cx6ND3KsLWI8NU1+VsL6gjPMlVorpkFSjSBAXdTRk+Es6LQ5cTz4ZmFhc=
=3Leo
-----END PGP SIGNATURE-----

--------------enigA56E933F3146F8FF26805438--

- Raw text -


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