Menu

Sponsored By: Password Angel - Share passwords, API keys, credentials and more with secure, single-use links.

Fixing: 08: value too great for base (error token is "08")

Summary

Bash script displays an error similar to:

08: value too great for base (error token is "08")

Reason

The is attempting to do a calculation like $item = $item - 1 and $item is a string value - in this case "08". This can be a result of trying to get the month using a date function. i.e.

item = $(date +%m)

Resolution

Explicitly state the base of a number using base#number so the item is 8 rather that 08.

item = $(date +%m)
item = $((10#$item))

or

item = $((10#$(date +%m)))

Enjoyed this article?

Thank you for reading this article! If you found the information valuable and enjoyed your time here, consider supporting my work by buying me a coffee. Your contribution helps fuel more content like this. Cheers to shared knowledge and caffeine-fueled inspiration!

Buy me a coffee

Originally published at https://chrisshennan.com/blog/fixing-08-value-too-great-for-base-error-token-is-08

Subscribe to my newsletter...

... and receive the musings of an aspiring #indiehacker directly to your inbox once a month.

These musings will encompass a range of subjects such as Web Development, DevOps, Startups, Bootstrapping, #buildinpublic, SEO, personal opinions, and experiences.

I won't send you spam and you can unsubscribe at any time.