Iterative calling ngspice from a script


I am trying to use the following script for octave.
The octave script is calling ngspice with the help of the following command:
system(sprintf("ngspice -b %s >/dev/null 2>/dev/null",simul.spicefilename));
Since my pc is running on Windows10, I changed the comand to:
system(sprintf("ngspice -b %s",simul.spicefilename));
Furthermore, I had to change from a batch mode to interactive mode to get the octave script running.
system(sprintf("ngspice -i %s",simul.spicefilename));
Now the script is running, ngspice opens and performs the simulation. However, after each ngspice simulation the ngspice application remains open and does not close, blocking the octave script to continue. I have to close the ngspice application manually to continue with the script. This is very annoying if there are hundreds of iterations in the octave script calling ngspice. Does anyone know, which flags/options I have to set in the ngspice command in order that ngspice closes after performing the simulation?

I am using a prebuild version of ngspice 34.

This is probably the wrong list. Your question is not linked to KiCad at all. So better send it to

Try adding the ngspice command ‘quit’ to the end of your simul.spicefilename.

See for example

1 Like

You could start by not throwing error messages away (to /dev/null) but showing them on your monitor.

@ holger
Thank you, now it is running.

I do have another question, going beyond the original one. I will post it into the other forum.