Shell script help

fbsd_user fbsd_user at
Wed Jun 29 02:52:14 GMT 2005

My sh shell script ability is not that good.
Have 2 simple coding problems.

How do I code a statement to subtract one from a field.

$rulenum = $rulenum - 1
$rulenum = '$rulenum - 1'

$rulenum = $rulenum - $one
$rulenum='$rulenum - $one'

None of that works. must really be simple.

I also have this line
inruleno=`ipfw list | sed -n -e "s/00\([0-9]*\) $inblock/\1/p"`

This works ok, the search argument  is  s/00\ but that is not good enough
because the number can be 0 to 65535. The sed -n -e "s/00\([0-9]*\ needs to
be changed to just return the first word.

Thanks for any help you can give.

More information about the freebsd-questions mailing list