Bash-convert-strings-to-int

From I Will Fear No Evil
Revision as of 12:07, 22 November 2021 by Chubbard (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In bash converting string values into integer values can be done this way:

c=$(( A+b ))
Anything within the (( )) is considered arithmetic

So the simplest way to convert to an int is simply c=$(($c))

swiped from site