Error Token 09
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn value too great for base (error token is 0008 ) more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
Value Too Great For Base Date
Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you,
Bash Associative Array Value Too Great For Base
helping each other. Join them; it only takes a minute: Sign up Shell Script Error: Value too great for base (error token is “08”) [duplicate] up vote 16 down vote favorite 1 This question already has an answer
Bash Force Base 10
here: Bash error: value too great for base (error token is “09”) 4 answers Here my problem is to find the difference of using single bracket [ ] and double brackets [[ ]] in if statement. #!/bin/bash vara=08; varb=10; ## single bracket in if statment is working. if [ $vara -lt $varb ]; then echo "yes"; else echo "no"; fi ## double brackets in if statment is not working; throwing an error like below. ## [[: bash base 10\ 08: value too great for base (error token is "08") if [[ $vara -lt $varb ]]; then echo "yes"; else echo "no"; fi bash shell share|improve this question asked Jul 16 '14 at 9:49 Thaangaraj 1551110 marked as duplicate by Charles Duffybash Users with the bash badge can single-handedly close bash questions as duplicates and reopen them as needed. May 11 at 21:40 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. add a comment| 1 Answer 1 active oldest votes up vote 29 down vote accepted The shell tries to interpret 08 as an octal number, as it starts with a zero. Only digits 0-7 are, however, allowed in octal, as decimal 8 is octal 010. Hence 08 is not a valid number, and that's the reason for the error. Single brackets are kind of "compatibility mode" with sh, and sh does not know about octal numbers. So, if you use single square brackets, "010" will be interpreted as 10, while with double square brackets, "010" will be interpreted as 8. If you use single square brackets, "08" will be interpreted as 8, while with double square brackets, it is not a valid number and leads to an error. You can avoid the error by using the solution de
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta bash remove leading zeros Discuss the workings and policies of this site About Us Learn bash value too great for base 09 more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us bash array value too great for base Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like http://stackoverflow.com/questions/24777597/shell-script-error-value-too-great-for-base-error-token-is-08 you, helping each other. Join them; it only takes a minute: Sign up Value too great for base (error token is “08”) bash up vote 2 down vote favorite I have seen on the forum that the problem is that I create octal instead of decimal, but I can't find out where to change my code to http://stackoverflow.com/questions/21763449/value-too-great-for-base-error-token-is-08-bash solve this. This is part of my code: dd=1234567890aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ ddate=$(exiv2 "${i}"|grep timestamp) SPEC=$ddate read X X YEAR MONTH DAY HOUR MINUTE SECOND <<<${SPEC//:/ } d1=${YEAR:2} d2=${dd:(MONTH-1):1} d3=${dd:(DAY-1):1} d4=${dd:(HOUR-1):1} d5=${dd:(MINUTE-1):1} d6=${dd:(SECOND-1):1} d7=0 Thank you for the help! string bash decimal octal share|improve this question asked Feb 13 '14 at 19:14 Helfenstein 90210 Can you do echo echo "$SPEC" | cat -vte and show its content here. –anubhava Feb 13 '14 at 19:25 possible duplicate of bash: value too great for base (error token is "0925") –devnull Feb 13 '14 at 19:34 add a comment| 1 Answer 1 active oldest votes up vote 5 down vote Tell bash that your variables are decimal, not octal d2=${dd:(10#$MONTH-1):1} d3=${dd:(10#$DAY-1):1} d4=${dd:(10#$HOUR-1):1} d5=${dd:(10#$MINUTE-1):1} d6=${dd:(10#$SECOND-1):1} share|improve this answer answered Feb 13 '14 at 19:32 glenn jackman 122k1782162 That was indeed the trick I was looking for. I was a bit confused where to put the 10#. Thank you a lot! –Helfenstein Feb 13 '14 at 20:55 add a comment| Y
HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Linux Forums > Linux - General http://www.linuxquestions.org/questions/linux-general-1/bash-scripting-value-too-great-for-base-error-token-is-08-a-824649/ Bash scripting: value too great for base (error token is "08") User Name Remember Me? Password Linux - General This Linux forum is for general Linux questions and discussion. http://www.unix.com/unix-for-dummies-questions-and-answers/159382-5-syntax-error-operand-expected-error-token-error.html If it is Linux Related and doesn't seem to fit in any other forum then this is the place. Notices Welcome to LinuxQuestions.org, a friendly and active Linux value too Community. You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today! Note that registered members see fewer ads, and value too great ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? 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. If you need to reset your password, click here. Having a problem logging in? Please visit this page to clear all LQ-related cookies. 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 guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the
& Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page... unix and linux operating commands > 5 ")syntax error: operand expected (error token is " error UNIX for Dummies Questions & Answers Thread Tools Search this Thread Display Modes #1 05-09-2011 metal005 Registered User Join Date: May 2011 Last Activity: 23 March 2015, 9:42 AM EDT Location: Netherlands Posts: 34 Thanks: 5 Thanked 1 Time in 1 Post > 5 ")syntax error: operand expected (error token is " error im kinda new to shell scripting so i need some help i try to run this script and get the error code > 5 ")syntax error: operand expected (error token is " the code for the script is Code: #!/bin/sh # # script to see if the given value is correct # # Define errors ER_AF=86 # Var is higher than five ER_BO=87 # Var is below one # Constants a=5 b=1 # Execute sio and # give var the output value of sio var="$(/disk/sio -p3 -b57600 -R)" echo $var echo # Test if var is above 5 if (( "$var" > "$a" )); then echo "test failed" # Var is higher than 5 exit $ER_AF else # Test if var is below 1 if (( "$var" < "$b" )); then echo "test failed" # var is below 1 exit $ER_BO else echo "test succes" # var is between 1 & 5 fi fi sio gives a numerical value as reply dont know whats wrong Last edited by metal005; 05-09-2011 at 09:35 AM.. Remove advertisements Sponsored Links metal005 View Public Profile Find all posts by metal005 #2 05-09-2011 methyl Advisor Join Date: Mar 2008 Last Activity: 8 June 2016, 9:58 PM EDT Posts: 6,402 Thanks: 288 Thanked 676 Times in 645 Posts Quote: var="$(/disk/sio -p3 -b57600 -R)" echo $var What is the output from this bit of the script? The error suggests that this is something to do with $var not being an integer number.