Hy guys! I have problems with writing bash script to run 50 times my script which generates data files and then plot it to file. I wrote smth like this, but it doesnt work
#!/bin/bash
for i in {1..50}
do
./ampl ampltst1 # generates different res.txt file each time
/usr/bin/gnuplot <<\__EOF
set xrange [-2:2]
set yrange [-2:2]
set term png
set output "image-${i}.png"
plot "res.txt" u 1:2 w lines, "res.txt" u 3:4 w lines, "res.txt" u 5:6 w li$
pause -1
__EOF
done
Please help me to fix this script!
Possibly you have problems with indentation: __EOF
must be without any leading spaces:
...
/usr/bin/gnuplot <<\__EOF
set xrange [-2:2]
...
__EOF
done
Also \
symbol is not required.
Also content of HERE-IS-DOCUMENT will be indented. Is that OK for gnuplot?
If no, you must remove indentation:
for i in {1..50}
do
./ampl ampltst1 # generates different res.txt file each time
/usr/bin/gnuplot <<__EOF
set xrange [-2:2]
set yrange [-2:2]
set term png
set output "image-${i}.png"
plot "res.txt" u 1:2 w lines, "res.txt" u 3:4 w lines, "res.txt" u 5:6 w li$
pause -1
__EOF
done