Thread View: gnu.bash.bug
2 messages
2 total messages
Started by Jim Frew
Thu, 24 Aug 1989 02:27
Re: parameter tests in Bourne shell
Author: Jim Frew
Date: Thu, 24 Aug 1989 02:27
Date: Thu, 24 Aug 1989 02:27
35 lines
2043 bytes
2043 bytes
In a recent bug-bash posting, cwjcc!kiwi!chet@gatech.edu (Chet Ramey) writes:
> ... this behavior has been in the Bourne
> shell since its creation (i.e. 7th Edition). Quoting from a random System
> 5 release 2+ man page (this happens to be from Ultrix 3.0 sh5):
>
> ${parameter:?word}
> If parameter is set and is non-null, substitute its
> value; otherwise, print word and exit from the shell.
> If word is omitted, the message ``parameter null or not
> set'' is printed.
>
> The wording is essentially the same for the 4.3BSD sh, which means it was in
> the 7th Edition sh.
For the record, the use of ":" to test whether the parameter is null was NOT
documented in the 7th Edition Bourne shell. The V7 manual page sez:
${parameter?word}
If parameter is set then substitute its value; otherwise,
print word and exit from the shell. If word is omitted then a
standard message is printed.
Bourne's 1982 book "The UNIX System" doesn't mention the ":" either (see p.
63). Since his book DOES mention System V, this leads me to believe that the
":" qualifier was a SVR2 invention (although it's not flagged as such in the
SVID).
This may seem a trivial point, unless you're trying to write portable shell
scripts (which is how I discovered it). Hopefully a portable shell (i.e.
bash) will eliminate the need for this kind of software archaeology.
#-----------------+-----------------------+-----------------------------
# James Frew | frew@crseo.ucsb.edu | Computer Systems Lab., UCSB
# +1 805 961 8413 | frew@ucsbuxa (BITNET) | Santa Barbara, CA 93106, USA
parameter tests in Bourne shell
Author: Brian Fox
Date: Thu, 24 Aug 1989 16:52
Date: Thu, 24 Aug 1989 16:52
32 lines
1685 bytes
1685 bytes
From: Jim Frew <frew%crseo@hub.ucsb.edu>
Date: 23 Aug 1989 1927-PDT (Wednesday)
In a recent bug-bash posting, cwjcc!kiwi!chet@gatech.edu (Chet Ramey) writes:
> ... this behavior has been in the Bourne
> shell since its creation (i.e. 7th Edition). Quoting from a random System
> 5 release 2+ man page (this happens to be from Ultrix 3.0 sh5):
>
> ${parameter:?word}
> If parameter is set and is non-null, substitute its
> value; otherwise, print word and exit from the shell.
> If word is omitted, the message ``parameter null or not
> set'' is printed.
>
> The wording is essentially the same for the 4.3BSD sh, which means it was in
> the 7th Edition sh.
For the record, the use of ":" to test whether the parameter is null was NOT
documented in the 7th Edition Bourne shell. The V7 manual page sez:
${parameter?word}
If parameter is set then substitute its value; otherwise,
print word and exit from the shell. If word is omitted then a
standard message is printed.
The ":" isn't what we are complaining about, it is the "?" that is
causing the behaviour in question.
Brian Fox
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads