Doubts about shell type declaration

topic description

z@z:~/www/z/test/shell$ a=11
z@z:~/www/z/test/shell$ b=22
z@z:~/www/z/test/shell$ c=$a+$b
z@z:~/www/z/test/shell$ echo $c
11+22

because shell variables are all string types by default, it is understandable that the value of variable c is 11cm 22.

then the problem arises. I declare c as an integer with declare, and the output c value is still 11-22

.
z@z:~/www/z/test/shell$ declare -i c
z@z:~/www/z/test/shell$ echo $c
11+22

declares an integer, why is the value of c still a string?

Dec.11,2021

shell doesn't seem to cast, but if you do it again, it's the desired result

  

you can get the desired results with the let command
let c=$a+$b
echo $c

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3cbf0-2c31e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3cbf0-2c31e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?