Operating System - Linux
1752793 Members
6216 Online
108789 Solutions
New Discussion

Re: Parameter substitution in shell: does ${##} work ?

 
SOLVED
Go to solution
Arturo Galbiati
Esteemed Contributor

Re: Parameter substitution in shell: does ${##} work ?

Hi,

/> X=00000034
/> echo $X
00000034
/> X=$(( X+0 ))
/> echo $X

the rtick is to add 0 to force the varibale to be an integer. In this way the leading zeros will be removed.

HTH,
Art
CAS_2
Valued Contributor

Re: Parameter substitution in shell: does ${##} work ?

Thanks, Peter