summaryrefslogtreecommitdiff
path: root/Windows/spice/examples/control_structs/if-batchmode.cir
diff options
context:
space:
mode:
Diffstat (limited to 'Windows/spice/examples/control_structs/if-batchmode.cir')
-rw-r--r--Windows/spice/examples/control_structs/if-batchmode.cir31
1 files changed, 31 insertions, 0 deletions
diff --git a/Windows/spice/examples/control_structs/if-batchmode.cir b/Windows/spice/examples/control_structs/if-batchmode.cir
new file mode 100644
index 00000000..b26b345c
--- /dev/null
+++ b/Windows/spice/examples/control_structs/if-batchmode.cir
@@ -0,0 +1,31 @@
+use $batchmode
+
+* use $batchmode variable to steer control flow
+*
+* start either with
+* ngspice -b -r rawfile.raw if-batchmode.cir
+* or with
+* ngspice if-batchmode.cir
+
+v0 1 0 dc 1
+R1 1 2 1k
+C1 2 0 1u
+
+.tran 100u 10m uic
+.print tran all
+
+.control
+
+if $?batchmode
+ echo "Info: batchmode has been set by command line option -b"
+ echo
+else
+ echo "Info: batchmode has not been set"
+ echo
+ unset ngdebug
+ tran 100u 10m uic
+ plot v(2)
+end
+
+.endc
+.end