bug-bash
[Top][All Lists]
Advanced

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

Re: forwarded weirdness report


From: Lawrence Velázquez
Subject: Re: forwarded weirdness report
Date: Mon, 28 Mar 2022 15:09:07 -0400
User-agent: Cyrus-JMAP/3.5.0-alpha0-4911-g925b585eab-fm-20220323.003-g925b585e

On Mon, Mar 28, 2022, at 3:06 PM, Martin Schulte wrote:
> on Mon, 28 Mar 2022 20:34:40 +0200 Alex fxmbsw7 Ratchev 
> <fxmbsw7@gmail.com> wrote:
>> https://pastebin.com/raw/T7ZnFapt
>
> 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

https://www.gnu.org/software/bash/manual/html_node/Aliases.html

    Bash always reads at least one complete line of input, and all
    lines that make up a compound command, before executing any of
    the commands on that line or the compound command.  Aliases are
    expanded when a command is read, not when it is executed.
    Therefore, an alias definition appearing on the same line as
    another command does not take effect until the next line of
    input is read.  The commands following the alias definition on
    that line are not affected by the new alias.

This also applies if the command defines the alias indirectly (e.g.,
by sourcing a second file that contains the `alias` commands).

-- 
vq



reply via email to

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