Кажется, вы смешиваете bash
и gnuplot
. Первые две строки выглядят как bash
, а остальные выглядят как gnuplot
, поэтому вы, вероятно, захотите что-то вроде этого:
#!/bin/bash
current_time=$(date +"%T")
new_time=$(date -d "10 seconds" +'%H:%M:%S')
# Start "gnuplot" passing in some "bash" variables
gnuplot <<EOF
set xdata time
set timefmt "%H:%M:%S"
set xrange ["$current_time":"$new_time"]
set format x "%H:%M:%S"
plot "sar-P-plots11" using 1:2
pause -1 "Hit any key to continue"
EOF
Сохраните сценарий как plotit
, а затем сделайте его исполняемым:
chmod +x plotit
, а затем запустите его с помощью:
./plotit