Martijn Dekker dixit:

>It works on every other shell, even pdksh.

That’s no excuse… pdksh does simple search for a matching )
in command substitutions, failing $(case x in y) ;; esac ).

>But this does not:
>
>$ var=$({ OPEN echo hi; CLOSE }) && echo "$var"
>mksh: syntax error: ')' unexpected

I see. Apparently, aliases are not parsed during recursing
into the parser (the exact feature fixing the aforementioned
pdksh bug). This is likely because it only needs to figure
out the syntax.

And… indeed:

tg@blau:~ $ x() {
> var=$({ OPEN echo hi; CLOSE; }) && echo "$var"
> }
tg@blau:~ $ typeset -f x
x() {
        var=$({ OPEN echo hi ; CLOSE ; } ) && echo "$var"
}
tg@blau:~ $ x
/bin/mksh: syntax error: ';' unexpected

Just what I expected if my speculation was true.


But: WHAT THE HEY ARE YOU DOING?! Implementing ALGOL in shell?

I think “we” agreed somewhere (maybe here, maybe in IRC, maybe
on the Austin ML) that doing weird things to the shell syntax
with aliases need not really be supported. So, please, do tell
me whether you *really* have a *legit* use case for… that.

Thanks,
//mirabilos
-- 
Yay for having to rewrite other people's Bash scripts because bash
suddenly stopped supporting the bash extensions they make use of
        -- Tonnerre Lombard in #nosec

Reply via email to