Robert Elz <k...@munnari.oz.au> wrote:

>
>       alias doit='my_command arg1 arg2;'
>
> with the ';' included to make sure the command ends there.
>
> Then some script used it like
>
>       doit; something-else
>
> and it fails - on some shells - not all perhaps, because those two ';'s
> have turned into the ';;' case operator, and as we're not in a case (it
> would be worse if we were) statement, it is a syntax error.   The syntax
> error complains about ';;' being unexpected at this point, and the user
> searches, and cannot find the ';;' sequence anywhere in their script.
> (Some other shells will generate two separate ';' tokens instead, and
> then perhaps complain about an invalid empty command (';' unexpected).
> Others might just do what the user hoped would happen.)

This is something an author of code needs to know...

> Aliases are just such an incredible botch that other than copy the exact
> implementation method, or whatever shell we pick as the one with "perfect"
> aliases (is there such a thing?), there's almost no way that independent
> implementations can result in the exact same thing in the weirder corner 
> cases.

Would you really say the same for CPP #defines?

Jörg

-- 
 EMail:jo...@schily.net                    (home) Jörg Schilling D-13353 Berlin
    joerg.schill...@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'

Reply via email to