What I want to do is write a script which first launches a program and then tells it to execute a bunch of commands and then quit. Lets go with an example.
I wrote this script myscript.sh
and it doesn't work the way I want it to. What it does is just run gnuplot and wait for it to quit and then runs the other commands; which obviously produces errors.
#!/bin/bash
gnuplot
plot sin(x)
pause -1
quit
I guess it is clear what I'm trying to do; if not, then let me know in the comments.
Best Answer
From
man gnuplot
or its online manpage:So what you probably want to run is the following command:
Other variants I proposed but which are not that useful were: