bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: forwarded weirdness report


From: Chet Ramey
Subject: Re: forwarded weirdness report
Date: Mon, 28 Mar 2022 16:18:05 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

On 3/28/22 3:06 PM, Martin Schulte wrote:
Hello,

on Mon, 28 Mar 2022 20:34:40 +0200 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> 
wrote:
https://pastebin.com/raw/T7ZnFapt

about inconsitency, about chets 'uh no bugs'

ive experienced this and such x times already ( got better, this is not my
code )

Here's a somewhat stripped down version:

$ bash --noprofile --norc -i -c "echo \$BASH_VERSION; shopt -s expand_aliases ; source <(echo 
\"alias x='echo hallo'\"); alias; x"
5.1.4(1)-release
alias x='echo hallo'
bash: x: command not found

OK, once more from the top.

The argument to -c is a single command. Bash always reads a complete command before executing any of it. The argument string is parsed into a
compound command: a compound list. Since the entire compound list is parsed
before executing any of the commands it contains, the `x' is parsed as a
simple command with no defined alias -- the parsing takes place before
executing the `alias x=...' command.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]