Bash Script

Tony Arnold tony.arnold at manchester.ac.uk
Tue Oct 24 12:38:45 UTC 2006


Karl,

On Tue, 2006-10-24 at 22:26 +1000, Karl Auer wrote:
> On Tue, 2006-10-24 at 12:10 +0100, Tony Arnold wrote:
> > 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.
> 
> Good call, but the code is still broken, because the problem was not
> only with printf, but also with the expansion of $Num in "Num=$((Num
> +1));"

Why is this broken in my version? $Num never gets leading zeros with my
code, so far as I can see, although I no longer have the original, so I
could be missing something.

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