Email List: Xaustin-group-lX
[All Lists]

Re: shell, arithmetic expansion and integer constants

To: Roger Marquis <marquis@xxxxxxxxx>
Subject: Re: shell, arithmetic expansion and integer constants
From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
Date: Tue, 17 Jun 2008 17:11:53 +0100
Cc: austin-group-l@xxxxxxxxxxxxx
References: <20080617140716.GN10734@prunille.vinc17.org> <20080617144902.39B972B59A0@mx5.roble.com> <20080617152636.GR5016@sc.homeunix.net> <20080617155824.9724E2B59E3@mx5.roble.com>
On Tue, Jun 17, 2008 at 08:58:24AM -0700, Roger Marquis wrote:
[...]
>> The POSIX sh (and utilities) spec is now embedded in the Single
>> Unix Specification which you can find on the opengroup web site.
>
> Only if you worship at the GNU "embrace and extend" church.  What other
> popular Unix-like OS implements POSIX's non-backwards compatible sh spec?

  HPUX
  FreeBSD
  OpenBSD
  NetBSD
  Linux
  Cygwin
  Solaris (sh in /usr/xpg4/bin/sh)

are those I've been exposed to.

In those

: ^ echo foo

Doesn't output "foo" as a Bourne shell would (though IIRC, POSIX
doesn't prohibit them from doing so).

a=1
{
  a=2
} 2> /dev/null
echo $a

doesn't output 1 as a Bourne shell would.

IFS=:
echo:a

doesn't output "a" as a Bourne shell would.

IFS=:
set a b c
echo "$*"

doesn't output "a b c" as a Bourne shell would... and so on.
  
All those sh are based either on bash, ksh88 or ash and conform
more or less exactly to the POSIX sh specification. There is no
Bourne sh POSIX specification. The POSIX sh spec is based on a
subset of ksh88 with a few modifications that ksh88 has then
integrated afterwards I think. But I'm not the expert.

-- 
Stéphane

<Prev in Thread] Current Thread [Next in Thread>