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

Re: Issues with cdrsin and USB devices on RHEL5



Bill Davidsen <davidsen@tmr.com> wrote:

> > Dear gods.  Didn't anyone tell them that $[ is deprecated?
> >
> > pos=$(($pos+1))
> >
> > ... is the preferred syntax, and is POSIX/ksh compatible.
> >
> >   
> Who cares? The $(( notation is slower to type, easier to get wrong, 
> gives confusing error messages if you miss the "$" and start with 
> parens, etc.  I know about it, but I would never use it, and it's 
> visually easier to read correctly.

Two "(" are definitely _much_ faster to type than a single "[".
Both is non-portable, $[ is not POSIX AFAIK.

> If you need max portability and/or readability you use "let pos=pos+1" 
> anyway.

Let is not in the shell. If you like maximum portability, use:

pos=`expr $pos + 1` 

Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de                (uni)  
       schilling@fokus.fraunhofer.de     (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily


Reply to: