The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
adding spaces for a variable value dnat Shell Programming and Scripting 2 02-26-2008 01:32 AM
adding PATH variable wir3d UNIX for Dummies Questions & Answers 3 09-19-2007 02:45 AM
Replace variable with a user defined variable ce124 Shell Programming and Scripting 1 04-15-2007 11:56 AM
Adding PATH variable in the startup scripts rajanishshetty UNIX for Dummies Questions & Answers 5 03-02-2007 08:51 AM
adding contents of a variable to a command gammarays Shell Programming and Scripting 2 02-08-2005 09:39 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-14-2007
Registered User
 

Join Date: Feb 2007
Posts: 2
adding 0 to a variable

Can anybody plz help me to solve this puzzle?

amt=00002280674231
((amt = amt + 0)) # to remove leading zero's

echo $amt

prints -2014293065

but this works fine for numbers less than 2000000000.

Thanks
S
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-14-2007
DukeNuke2's Avatar
Soulman
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 1,212
should have to do with that:
http://en.wikipedia.org/wiki/Data_type
Reply With Quote
  #3 (permalink)  
Old 02-14-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,356
Use this instead...
$ x=00000000009822837365732994374589558483928287384458
$ echo ${x##+(0)}
9822837365732994374589558483928287384458
$
Reply With Quote
  #4 (permalink)  
Old 02-14-2007
Registered User
 

Join Date: Feb 2007
Posts: 2
typeset -LZ amt also removes leading zero's
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0