Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Leading 0

Status
Not open for further replies.

hlyeoh

MIS
May 31, 2004
22
MY
Hi

I am looking for a way to shorten the following script, is there any other options?Thanks.

if [ $t_seq_number -le 9 ]
then
t_seq_number1="0000000000"$t_seq_number
else
if [ $t_seq_number -le 99 ]
then
t_seq_number1="000000000"$t_seq_number
else
if [ $t_seq_number -le 999 ]
then
t_seq_number1="00000000"$t_seq_number
else
if [ $t_seq_number -le 9999 ]
then
t_seq_number1="0000000"$t_seq_number
fi
fi
fi
fi
 
Thanks. I need to ksh in this case. If anyone knows other than using ksh, please tell me.
 
Hi Feherke,

The number must only be limited to 11 and not increasing length. But thanks for the feedback.
 
Feherke's suggestion should do exactly what you want, does it not work for you?

Annihilannic.
 
yes, it works terrific !! Thanks Annihilannic and Feherke for the suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top