bug-bash
[Top][All Lists]
Advanced

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

Re: is it a bug


From: Alex fxmbsw7 Ratchev
Subject: Re: is it a bug
Date: Fri, 20 Nov 2020 00:10:44 +0100

that ive written not nothing.. big thanks for your true efford, and thanks
for future bugfixing it, ..important issue
i also had the same with && after [[ somewhere with also fail
but since i switched to one command one line it all yet works, the bit that
im trying

thanks, peace

On Tue, Nov 17, 2020, 07:37 L A Walsh <bash@tlinx.org> wrote:

> On 2020/11/16 11:02, Alex fxmbsw7 Ratchev wrote:
> > on my way for a new paste
> Anytime you start going over multiple lines in an alias, you
> need to consider the use of a function, where 'need' would ideally
> increase in proportion to the number of lines you are including.
>
> For increased readability, I took out 'aal' being prepended to
> every variable except the two usages of 'aal[...]' where I substituted
> 'foo' for 'aal'.  NOTE: the code seems to use 'foo' (or 'aal') without it
> being initialized.
>
> The main oddity I found was that if (in my version),
>     t=""
> is on the same line as 'res=()', I get the error with unexpected ';'
> since it doesn't seem to parse the 'for' statement's "for", so the
> semi after it is unexpected.
>
> For some strange reason, the parsing of the array doesn't break off
> at the space, in fact, when the lines are split, the alias seems
> to lose some spacing (note 'res=t='):
>
>   executing alias +ax
>   res=t=
>   alias -- "t="
>
> This seemed to be the minimum difference between a working & non working
> case.  Either (for no error):
>   an_alias='res=()
>             t=""
>             for ci in "${!foo[@]}"; do \
>
> or (to reproduce error):
>   an_alias='res=() t=""
>             for ci in "${!foo[@]}"; do \
>
> error I got was:
> ./aldef.sh: array assign: line 23: syntax error near unexpected token `;'
> ./aldef.sh: array assign: line 23: `res=() t=""
>
> It is doing something weird -- I suspect that
> alias expansion is expanding the right side as 'text' and not
> as code that gets interpreted when the substitution occurs.
>
> Try reserving aliases where it is needed (something a function can't do)
> or where it helps legibility.
>
> Hope this helps...oh....including the version that gives an error.
> To see version that works, split the 't=""' to be on the line
> below the 'res=()'.
>
> -linda
>
>
>
>


reply via email to

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