Home > Bash Script > Bash Script Error Value Too Great For Base

Bash Script Error Value Too Great For Base


asked 2 years ago viewed 11439 times active 2 years ago Linked 16 Shell Script Error: Value too great for base (error token is “08”) 1 Shell Error: value too great I am only having one problem whenever this part of the script Code: if [ $((items)) -eq 0 ] ; then comes across a 08 or 09 it throws an error Max: row=$((result / 11 +1)) column= $((result % 11 +1)) direction=$direction\n" scripting share|improve this question edited Feb 16 '15 at 1:04 asked Feb 16 '15 at 0:59 Michael Durrant 9,6062174118 1 How's the CMD trip bonuses from extra legs work? navigate here

Code: cd /bb/backup/svn find *.gz -type f -a -mtime +8 -exec rm {} \; But because we suffer from a annoying time drift since we use AWS for these particular servers. As octal is base 8 with digits ranging from 0 to 7, 08 is out of range for octal. If it is Linux Related and doesn't seem to fit in any other forum then this is the place. thanks man Sagar marked as solved for others who might find it useful Last edited by sagarhshah; January 26th, 2008 at 01:01 AM.

Bash Value Too Great For Base (error Token Is

Subtraction with a negative result Password Protected Wifi, page without HTTPS - why the data is send in clear text? If you'd like to contribute content, let us know. So sayeth the Shepherd Symbolic comparison of recursive functions Is there a way to make a metal sword resistant to lava? As the only digits allowed in octal are {0..7}, an 8 or a 9 will cause the evaluation to fail.

  1. As you have already seen, arithmetic is performed using the expr command.
  2. BTW, it seems faster than something like: n=${n#0000000000000000}; n=${n#00000000}; n=${n#0000}; n=${n#00}; n=${n#0}. –vinc17 Feb 16 '15 at 2:13 add a comment| Your Answer draft saved draft discarded Sign up or
  3. You can avoid the error by using the solution described here: http://stackoverflow.com/a/12821845/1419315 if [[ ${vara#0} -lt ${varb#0} ]] or if [[ $((10#$vara)) -lt $((10#$varb)) ]] share|improve this answer edited May 11
  4. But bash treats integers starting with 0 as octal values, so you're ok from 01-07, but 08 and 09 are illegal in all of your arithmetic functions.
  5. So, if you use single square brackets, "010" will be interpreted as 10, while with double square brackets, "010" will be interpreted as 8.

As for the grid - actually I put the pattern there myself. This is the only thing in my script which is not working. Browse other questions tagged bash or ask your own question. Bash Script Error Output Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us.

How to deal with a really persuasive character? Bash Value Too Great For Base 08 This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. The following is just an example of how to fetch various strings for "yesterday". The time now is 07:28 PM.

View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by David the H. 08-06-2010, 04:43 PM #3 David the H. Bash Script Error Log no outgoing connection via ipv4 spectral norm of block-wise sums of matrices What does an 'ü' mean? bash share|improve this question asked Jan 10 '14 at 16:45 user3178889 66127 1 You can't just subtract dates in the form YYYY-MM-DD. Greetings, X3MBoy Adv Reply Quick Navigation Programming Talk Top Site Areas Settings Private Messages Subscriptions Who's Online Search Forums Forums Home Forums The Ubuntu Forum Community Ubuntu Official Flavours Support

Bash Value Too Great For Base 08

Please explain the local library system in London, England A name for a well-informed person who is not believed? I know this post is two years old, but maybe you'll get a thanks in your email. Bash Value Too Great For Base (error Token Is What does Sauron need with mithril? Bash Script Error Command Not Found Offline #5 2006-01-11 16:52:45 smoon Member Registered: 2005-08-22 Posts: 468 Website Re: Bash script aid - 'value too great for base' error Komodo wrote:(...) This is from http://www.codecoffee.com/tipsforlinux/ … 2/044.html ,

Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap - Main Menu Linux Forum Android Forum Chrome OS Forum Search LQ check over here If those answers do not fully address your question, please ask a new question. Line 32: value too great for base (error token is "08") #!/bin/bash setup () { grid=(01 02 03 04 05 06 07 08 07 06 05 12 13 14 15 16 more hot questions lang-sh about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation Science Other Bash Script Error Check

Numerical values starting with a zero (0) are interpreted as numbers in octal notation by the C language. Otherwise it is treated as an octal number. (Or check dogbane's answer) –hek2mgl Jan 10 '14 at 17:03 add a comment| Your Answer draft saved draft discarded Sign up or Generally I'm working through Project Euler, one language at a time. –Michael Durrant Feb 16 '15 at 16:13 add a comment| 1 Answer 1 active oldest votes up vote 3 down his comment is here Password Linux - General This Linux forum is for general Linux questions and discussion.

Or buy me a beer?: Recently Changed Pages: View All Pages View All Q Pages ad admt aix apache backup blog bordermanager cisco cloud config dutch edirectory email fiber fix gpo Bash Script Error Message So an alternative to true, as we have also seen, is the ":" command. I haven't worked through everything yet, but it appears that somehow your MONTHS value is coming out as "08", and the leading zero in that is unusable as the index number

still the first error "value too great for base .." –user3178889 Jan 10 '14 at 16:58 As @robbrit says, remove the leading zero from 09 or better fix the

more hot questions question feed lang-bsh about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation share|improve this answer answered Jan 10 '14 at 17:07 rojomoke 1,382617 add a comment| up vote 5 down vote What are d1 and d2? more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed Bash Script Error Exit How does the pilot control the Dassault Rafale?

I always appreciate your help! Now you have two options to do decimal calculation: Omit preceding 0: $ echo $(( 12 - 8 )) 4 Explicitly mention base as decimal by 10#: $ echo $(( 12 Once I find out what I can update the question to be more general and applicable to others perhaps. http://onlinetvsoftware.net/bash-script/bash-script-tar-error.php Otherwise, numbers take the form [base#]n, where the optional base is a decimal number between 2 and 64 representing the arithmetic base, and n is a number in that base.

Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. How to pluralize "State of the Union" without an additional noun? echo foo#bar #baz will output foo#bar but not #baz, because the latter starts a comment. –deltab May 9 at 19:52 add a comment| Your Answer draft saved draft discarded Sign Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started

mon=10#$`date +'%m'` All the rest does not need to be changed. I can't help with a cure however... The error message is, however, quite easily explained. Since there's no number 8 in octal bash is complaining that the value's too great for this base.

You need something like this instead: Code: DAYS=( Sat Sun Mon Tue Wed Thu Fri Sat ) MONTHS=( Dec Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. Adv Reply January 26th, 2008 #7 sagarhshah View Profile View Forum Posts Private Message A Carafe of Ubuntu Join Date May 2006 Location Mombasa, Kenya Beans 82 DistroUbuntu 10.04 Lucid Enjoy the ride!!

Bash will interpret that as an octal, which means 08 and 09 are invalid. Bash Guru Registered: Jun 2004 Location: Osaka, Japan Distribution: Debian sid + kde 3.5 & 4.4 Posts: 6,823 Rep: One last post. To do it gnereally you need like: $((1$n%(11$n-1$n)/10)). –mikeserv Feb 16 '15 at 1:29 @mikeserv Parentheses are missing in your general solution.