Hi Friends,
I have written a bash script which reads values from a csv file. The script runs fine until it encounters a floating point number in the CSV file. My code has following "if condition" statement inside a "while read .... done<$input" loop. What I am trying to do here is put negative sign before the number if certain conditions are met.
Code:
if [[ Some Condition ]]; then Txn_amount=-$(( $Txn_amount )) fi
ParseCsv.sh: line 33: 36524.41 : syntax error: invalid arithmetic operator (error token is ".41 ").
Here the script is crashing when it encounters a floating point number 36524.41 in the CSV file. Please suggest me what change in code is required to ensure that script process floating point number to correctly. Thanks.
برچسب:
نویسنده: استخدام کار