Subject: Re: Suggestion: inclusion of the truncate(1) utility into the tree
To: None <tech-userlevel@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: tech-userlevel
Date: 07/22/2000 18:07:56
[ On Saturday, July 22, 2000 at 10:37:14 (-0700), Jason R Thorpe wrote: ]
> Subject: Re: Suggestion: inclusion of the truncate(1) utility into the tree
>
> On Sat, Jul 22, 2000 at 12:59:29PM -0400, Andrew Brown wrote:
> 
>  > lim=0
>  > sect[$lim]=main;        alt[$lim]="MAIN";               lim=`expr $lim + 1`
>  > sect[$lim]=tv;          alt[$lim]="TELEVISION";         lim=`expr $lim + 1`
>  > 
>  > but solaris's /bin/sh doesn't do that, and neither does netbsd's.  the
>  > "well-defined" set of features is blurred by the fact that "everyone
>  > supports it", but everyone also adds their own stuff.  it's hard for
>  > me to tell where it starts and ends.  :(
> 
> The Single UNIX Specification is available online at www.opengroup.org.
> The sh(1) described there is essentially POSIX sh(1).

Indeed, but pretty well any manual will tell you that sh(1) does not
support array variables.  Array variables are a ksh(1) extension.  And
if you're going to use ksh extensions then you should use ksh arithmetic
expressions too so that you don't have to use 'expr'.

Until you've gained a lot of experience about portability you should
always ignore the vendor documentation when you're trying to write
portable code -- only use the standards themselves (or guides based on
them).  Only if something doesn't work as the standard documents it
should you ever refer back for comparison to the vendor documents.

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>