I have a bash script with the following line. The variables start_time
and start_files[$i]
are floating point numbers. I want to compare them using the command bc
as follows:
result1=$(bc -l <<< $start_time'>='${start_files[$i]})
When I run the script I always receive the following error.
(standard_in) 1: syntax error
I've checked that this error is due to this line. What am I doing wrong? The thing that this happens to me when using bash 4.1, with bash 4.3 runs fine. However I need to run the script with bash 4.1.
The bc
command works however the input doesn't work. The variable start_files
is read from a file with this command
IFS=, read -r -a start_files <<< $(head -n 1 file.txt)
Basically I want to read all the values from the first line separated by a coma and store them to different positions of the array. However using bash 4.1 all the values end up stored in start_files[0]
. How can I solve this? This lines works for bash 4.3