help-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: Alex fxmbsw7 Ratchev
Subject: Re: why does this define bla() instead of respect the newline as command separator
Date: Fri, 19 Mar 2021 10:17:57 +0100

oh i know, it works as expected by alias definition, there is no space
between alias defined and op, so it gets expanded correspondingly

thank you

On Fri, Mar 19, 2021, 10:14 Mike Jonkmans <bashbug@jonkmans.nl> wrote:

> 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]