X-Recipient: archive-cygwin@delorie.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@redhat.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@cygwin.com, th.wm@gmx.de
Subject: Re: alias command not effective
References: <ih0u79$44j$1@dough.gmane.org>
In-Reply-To: <ih0u79$44j$1@dough.gmane.org>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigA56E933F3146F8FF26805438"
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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@redhat.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--
