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

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 <oguzismailuysal@gmail.com> wrote:

> On Fri, Mar 19, 2021 at 4:11 PM Chet Ramey <chet.ramey@case.edu> 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 position where a simple command can be parsed,
>> so it's subject to alias expansion.
>>
>
> 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
> c w i w p e
> c w i w p u s e
> $
> $ for sh in ash 'bash -O expand_aliases' bosh dash gwsh ksh mksh oksh yash
> zsh; do echo $sh; $sh <foo.sh; done
> ash
> Linux
> bash -O expand_aliases
> bash: line 2: syntax error near unexpected token `newline'
> bash: line 2: `c w i e'
> bosh
> Linux
> dash
> Linux
> gwsh
> Linux
> ksh
> ksh: syntax error at line 2: `i' unexpected
> mksh
> Linux
> oksh
> Linux
> yash
> Linux
> zsh
> zsh: parse error near `i'
> zsh: parse error near `i'
> zsh: parse error near `i'
>
>
>>
>>
>> --
>> ``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]