How to add values in a variable in Unix shell scripting?

前端 未结 9 2015
谎友^
谎友^ 2021-02-19 02:14

I have two variables called count1 and count7

count7=0
count7=$(($count7 + $count1))

This shows an error \"expression is not complete; more tok

9条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-19 02:56

    In ksh ,bash ,sh:

    $ count7=0                     
    $ count1=5
    $ 
    $ (( count7 += count1 ))
    $ echo $count7
    $ 5
    

提交回复
热议问题