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

2021-03-29 Thread Chet Ramey
On 3/29/21 12:04 PM, Alex fxmbsw7 Ratchev wrote: case statements are imho string comparision, nothing to do with aliases "'The question is,' said Humpty Dumpty, 'which is to be master — that’s all.'" -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, v

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

2021-03-29 Thread Alex fxmbsw7 Ratchev
case statements are imho string comparision, nothing to do with aliases On Mon, Mar 29, 2021, 17:23 Chet Ramey wrote: > On 3/19/21 10:59 AM, Oğuz wrote: > > > Not much related, but isn't this supposed to work? > > > > $ cat foo.sh > > alias c='case ' w='foo ' i='in ' p=') ' e='esac' u='uname ' s

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

2021-03-29 Thread Chet Ramey
On 3/19/21 10:59 AM, Oğuz wrote: Not much related, but isn't this supposed to work? $ cat foo.sh alias c='case ' w='foo ' i='in ' p=') ' e='esac' u='uname ' s='; ' c w i e Bash is pretty careful not to perform alias expansion in case statement pattern lists, even to the point where that over

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

2021-03-19 Thread Oğuz
19 Mart 2021 Cuma tarihinde Robert Elz yazdı: > Date:Fri, 19 Mar 2021 17:59:18 +0300 > From:=?UTF-8?B?T8SfdXo=?= > Message-ID: ar2vo1zribryvegnu...@mail.gmail.com> > > > | Not much related, but isn't this supposed to work? > > It is perhaps no surprise (considerin

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

2021-03-19 Thread Robert Elz
Date:Fri, 19 Mar 2021 17:59:18 +0300 From:=?UTF-8?B?T8SfdXo=?= Message-ID: | Not much related, but isn't this supposed to work? It is perhaps no surprise (considering their relationship with dash) that the FreeBSD and NetBSD shells (at least a reasonably up to d

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

2021-03-19 Thread Alex fxmbsw7 Ratchev
try with dev bash version, aliases work there, also include an ending space in your aliases to make the next get expanded instead of passed as arg On Fri, Mar 19, 2021, 15:59 Oğuz wrote: > On Fri, Mar 19, 2021 at 4:11 PM Chet Ramey wrote: > >> On 3/19/21 4:12 AM, Alex fxmbsw7 Ratchev wrote: >>

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

2021-03-19 Thread Oğuz
On Fri, Mar 19, 2021 at 4:11 PM Chet Ramey wrote: > On 3/19/21 4:12 AM, 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() .. > > `n' is the first word in a positio

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

2021-03-19 Thread Alex fxmbsw7 Ratchev
yes, thank you On Fri, Mar 19, 2021, 14:11 Chet Ramey wrote: > On 3/19/21 4:12 AM, 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() .. > > `n' is the first word

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

2021-03-19 Thread Chet Ramey
On 3/19/21 4:12 AM, 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() .. `n' is the first word in a position where a simple command can be parsed, so it's subject to alias expansion. -- ``Th

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

2021-03-19 Thread Robert Elz
Date:Fri, 19 Mar 2021 16:23:55 +0700 From:Robert Elz Message-ID: <18800.1616145...@jinx.noi.kre.to> Sorry for all the typos... | nothing to do with the \n that woukd have | worked just fine. I was "typing" that reply from my phone, something I do a much worse jo

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

2021-03-19 Thread Robert Elz
Date:Fri, 19 Mar 2021 09:12:34 +0100 From:Alex fxmbsw7 Ratchev Message-ID: | eval $'alias n=bla\nn() { type $FUNCNAME ; }\nn' | bla is a function | bla () | { | type $FUNCNAME | } | | it was supposed to be n() .. nothing to do with the \n that

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

2021-03-19 Thread Alex fxmbsw7 Ratchev
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 wrote: > On Fri, Mar 19, 2021 at 09:12:34AM +0100, Alex fxmbsw7 Ratchev wrote: > > eval $'alias n=bla\nn()

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

2021-03-19 Thread Mike Jonkmans
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=b

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

2021-03-19 Thread Alex fxmbsw7 Ratchev
eval $'alias n=bla\nn() { type $FUNCNAME ; }\nn' bla is a function bla () { type $FUNCNAME } it was supposed to be n() ..