linux - Expression as a string (shell scripting) -
this question has answer here:
- bash: evaluate mathematical term? 7 answers
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
Post a Comment