linux - Expression as a string (shell scripting) -


this question has answer here:

i have expression declared string , want output result of expression. trying solve using shell scripting. example

expr="123+456"  

expecting output

579 

thanks in advance.

you need arithmetic expransion syntax:

$ expr="123+456" $ answer=$(($expr)) $ echo $answer 579 

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -