bash shell script fibonacci not showing value 2 after 0 1 1?

后端 未结 2 557
无人共我
无人共我 2021-01-26 08:13

I am writing a bash script for fibonacci which is not printing the value after 0 1 1 . It is not printing \"2\" after 0 1 1. The code is given below.

echo \"ent         


        
2条回答
  •  不要未来只要你来
    2021-01-26 09:08

    In bash, do not use the dollar sign on the left hand side of an assignment.

    $c=$a+$b

    should be

    c=$a+$b

    but it probably still does not do what you want, try

    c=$((a+b))
    

    instead.

提交回复
热议问题