On Sun, 17 Aug 2008, Randall R Schulz wrote:-
On Sunday 17 August 2008 16:13, David Bolt wrote:
# -r allows sed to use regex in the script, # ^0+ matches any number of leading zeros CURNUM=$(ls /etc/apache2/sites-enables|cut -d- -f1|tail -1|sed -r "s#^0+##")
NEWNUM=`expr $CURNUM + 1`
# no need for expr to increment $NEWNUM NEWNUM=$(( ${CURNUM} + 1))
Now you're in for BASH's interpretation of digit strings as octal numbers when the first character is a zero.
Which won't matter because the addition of: sed -r "s#^0+##" to the initial assignment of $CURNUM should have stripped them off. Regards, David Bolt -- Team Acorn: http://www.distributed.net/ OGR-P2 @ ~100Mnodes RC5-72 @ ~15Mkeys SUSE 10.1 32 | | openSUSE 10.3 32b | openSUSE 11.0 32b | openSUSE 10.2 64b | openSUSE 10.3 64b | openSUSE 11.0 64b RISC OS 3.6 | TOS 4.02 | openSUSE 10.3 PPC | RISC OS 3.11 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org