I'm trying to make a bash script in combination with gnuplot. I'm using an input file 'input.list' containing the single-column list of files to be analyzed with gnuplot. I'm using a following bash script:
#!/bin/bash
while read -r line
do
...
#Other operations on files
...
gnupinp=$line
gnuplot -e "input='${gnupinp}'; plot input u 1:2; pause -1"
done < input.list
There are two issues probably connected:
When first file from the list is analyzed the plot is created but the pause -1
seems to be neglected while pause 1
works fine.
No matter if I use pause -1
or pause 1
the script fails starting from the #Other operations on files
part when the second file from the list is executed.
The same behavior can be obtained when I use system 'sleep 1'
command in gnuplot.
When I neglect pause
command the gnuplot scripts are preformed properly for all listed files.
thanks in advance for any help
You are using the standard input in two competing ways: feeding the data to read
, and to gnuplot's pause -1
.
If you want the user to be able to interact with gnuplot by pressing return after the graph is plotted, you have to use some other way than stderr to feed your script with data, e.g. read from a file.