Bashスクリプト内にある次のコードを実行しようとしました。
NUMBER=600
LOSS_RATE=0,3
TOT_PKT=100
test=$(python -c "from math import ceil; print ceil($NUMBER * 500.0)")
test2=$(python -c "from math import ceil; print ceil($NUMBER * $LOSS_RATE)")
echo $test
echo $test2
次のように印刷されます。
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: ceil() takes exactly one argument (2 given)
300000.0
最初のPythonコマンドが実行されますが、2番目のコマンドは指定されたTypeErrorを引き起こします。これを解決するにはどうすればよいですか?