I am writing a bash script (.sh file) to run a program called "lenstool". Before fully running as I type directly in the terminal, "lenstool" opens a text file in vim. I must quit vim by typing :q and hitting enter. Then the program would do what it is supposed to do. Now, I want run "lenstool" a few thousand times. How can I automatically exit vim within a bash script file?
One solution that comes to my mind is doing:
id=$(ps -A | grep vim | awk '{print $1}')
to get pid(s) of the running vim program(s) and then kill it with:
kill $id
of course you need to save your work first and then do this. I'm not sure how your program saves what is has done!
lenstool
a program you wrote? Can you change it? – James Nov 2 '16 at 21:35