Hi All,
Trying to do some maths and i want to keep the leading zero's at the end of the equations....
Code:
echo $((00010-1))
9
Well this is no good, i need to use something so that i can do things like arbitrary amounts of leading zeros can all be in the answer at the end of the equation.
ie
Code:
echo $((010-1))
009
echo $((0001110-1))
0001109
echo $((00000010-1))
00000009
Etc etc, Is this possible in bash without having to use a multitude of commands and other scripts. I've read its possible in perl but so far most places on the net seem to talk about how to remove the damn leading 0's, when i want to keep them. I know i could write a long script that counts the number of '0' characters before a different number is seen and then just adding those as leading zero's after the arithmatic has taken place but there must be a simpler method?
Cheers All