bug-bash
[Top][All Lists]
Advanced

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

Re: why does this define bla() instead of respect the newline as command


From: Mike Jonkmans
Subject: Re: why does this define bla() instead of respect the newline as command separator
Date: Fri, 19 Mar 2021 10:13:02 +0100

On Fri, Mar 19, 2021 at 09:12:34AM +0100, Alex fxmbsw7 Ratchev wrote:
> eval $'alias n=bla\nn() { type $FUNCNAME ; }\nn'
> bla is a function
> bla ()
> {
>     type $FUNCNAME
> }
> 
> it was supposed to be n() ..

The eval $'...' can be left out.


$ echo $BASH_VERSION
5.0.17(1)-release
$ alias n=bla
$ n() { type $FUNCNAME; }
$ declare -pf n
bash: declare: n: not found
$ declare -pf bla 
bla ()
{
        type $FUNCNAME
}

It is the same on 5.1.4(1)-release.

I would have expected that n was a defined function.
But I would not have bet on it.

Regards, Mike Jonkmans



reply via email to

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