17 Aug
2008
17 Aug
'08
23:19
On Sunday 17 August 2008 16:13, David Bolt wrote:
On Sun, 17 Aug 2008, Nick Zeljkovic wrote:-
Hi Listmates,
Current code: CURNUM=`ls /etc/apache2/sites-enabled|cut -d- -f1|tail -1`
# -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.
...
Regards, David Bolt
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org