[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: function invoking alias fails if defined in same conditional
From: |
Chet Ramey |
Subject: |
Re: function invoking alias fails if defined in same conditional |
Date: |
Sat, 17 Mar 2012 12:16:45 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 3/17/12 8:09 AM, Eric Blake wrote:
> On 03/16/2012 02:56 PM, gregrwm wrote:
>> a function invoking an alias works, unless they are defined within the same
>> conditional, eg:
>
> Thanks for the report, but this is not a bug. Remember, aliases affect
> parsing, so they can only be expanded during the parsing phase. But
> bash has to parse until the end of a compound command before it can do
> any action within the command. In that sense, 'alias' is exactly like
> 'set -v' just recently discussed here:
> https://lists.gnu.org/archive/html/help-bash/2012-03/msg00025.html
The manual page has this to say:
"To be safe, always
put alias definitions on a separate line, and do not use alias in com-
pound commands."
Chet
- --
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9kuN8ACgkQu1hp8GTqdKsWBwCeMKkybgdM31sig8O6aVv62cPd
W6IAn3yAKnmTfhwo8S1VW1Z63i/PmgwT
=PVXT
-----END PGP SIGNATURE-----