本から次のスクリプトファイルを作成しました。
a=2
b=3
c=$[a+b]
echo 'The result is:' $c
このプログラムを実行した後、5を取得する代わりに、次のように出力されます。
The result is: $[a+b]
本から次のスクリプトファイルを作成しました。
a=2
b=3
c=$[a+b]
echo 'The result is:' $c
このプログラムを実行した後、5を取得する代わりに、次のように出力されます。
The result is: $[a+b]
You shouldn't be using []
:
Go for this (with the (())
brackets:
a=2
b=3
c=$((a+b))
echo 'The result is:' $c
returns:
The result is: 5