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

Re: Issues with cdrsin and USB devices on RHEL5



Greg Wooledge wrote:
On Mon, Jul 14, 2008 at 10:45:25PM +0200, Giulio Orsero wrote:
============ /lib/udev/check-cdrom.sh
#!/bin/bash
...
        pos=$[$pos+1]

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.

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

This is a cd burning list, not the alt.shell.pedantic newsgroup. Let's keep to the main topic.

--
Bill Davidsen <davidsen@tmr.com>
 "Woe unto the statesman who makes war without a reason that will still
be valid when the war is over..." Otto von Bismark


Reply to: