You can do basic math with an integer in bash by wrapping the expression in $((and )).
$ echo $(( 5 + 8 ))
13
In your specific case, the following works for me:
$ echo "${new_size}-${current_size}"
802-789
$ echo $(( ${new_size}-${current_size} ))
13
Your end result is a bit strange. Make sure that the grep expression really gives the desired result. If not, you may need to wrap the regular expression in quotation marks.
source
share