Bash Script
Tony Arnold
tony.arnold at manchester.ac.uk
Tue Oct 24 11:10:44 UTC 2006
OOzy,
On Tue, 2006-10-24 at 13:53 +0300, OOzy Pal wrote:
> Num=$((Num+1));
> Num=$(printf %02d $Num)
> PROJECT=$Num-$PROJECT
Change this to:
Num=$((Num+1));
prefix=$(printf %02d $Num)
PROJECT=$prefix-$PROJECT
The problem is that $NUM has the leading zeros, so when it gets
substituted in the printf line, bash thinks it is an octal number,
because numbers starting with a zero are considered octal. By keeping
$NUM as just the number, you avoid this.
Regards,
Tony.
--
Tony Arnold, IT Security Coordinator, University of Manchester,
IT Services Division, Kilburn Building, Oxford Road, Manchester M13 9PL.
T: +44 (0)161 275 6093, F: +44 (0)870 136 1004, M: +44 (0)773 330 0039
E: tony.arnold at manchester.ac.uk, H: http://www.man.ac.uk/Tony.Arnold
More information about the ubuntu-users
mailing list