tech-userlevel archive

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

Re: Unanticipated /bin/sh change a few weeks ago

    Date:        Sun, 18 Jun 2017 12:15:06 +0200
    From:        Edgar =?iso-8859-1?B?RnXf?= <>
    Message-ID:  <>

  | > Which of those do people think best?
  | What does Lin^Wbash allow?

bash implements just posix function definitions (only compound commands.)
(They also allow a form with a "function" keyword, as does ksh93, but that's
not material.)  So does yash.

dash allows a simple command on a function definition, but strictly
that (not ! simplecommand).  So does zsh, and ksh93, and the FreeBSD shell.
This is what we have today.

mksh (and our pdksh derived /bin/ksh) permit fn () ! command (and fn() cmd)

Note I tested what is allowed for definitions, I didn't test that they
worked as expected...

There's also almost no rational reason anyone would use the
extra (non standard) syntax in a script (and if they do, they deserve
to have it fail - scripts should always use standard syntax when
possible, abbreviating to save a few bytes isn't worth the hassle).

The most likely uses for the abbreviated form are for interactive typing.


Home | Main Index | Thread Index | Old Index