Code: Select all
// clodemo.hoc
// demonstrates use of the command line to pass a parameter to NEURON
num = -999
if (name_declared("x")==5) { // x has been assigned a numerical value
num = x
}
print "num is ", num
quit()
Code: Select all
[ted@loki batchdemo]$ nrniv clodemo.hoc
. . . (banner omitted for clarity) . . .
num is -999
-nobanner -c "x=3"
and you get this:
Code: Select all
[ted@loki batchdemo]$ nrniv -nobanner -c "x=3" clodemo.hoc
num is 3
The following shell script, which I will call clodemojob, runs clodemo.hoc three times, each time with a different value of num:
Code: Select all
#!/bin/sh
nrniv -nobanner -c "x=1" clodemo.hoc
nrniv -nobanner -c "x=PI" clodemo.hoc
nrniv -nobanner -c "x=exp(1.41)" clodemo.hoc
Code: Select all
[ted@loki batch]$ ./clodemojob
num is 1
num is 3.1415927
num is 4.0959554
Start an rxvt window by clicking on the rxvt item in the NEURON program group.
Use the following commands as needed to find out where you are and navigate to the directory that contains your shell script and hoc file:
Code: Select all
pwd prints the path to the current directory.
An rxvt window starts in /cygwin/c, which is the same location as c:\
Hint: save keystrokes by using "tab completion" (see http://en.wikipedia.org/wiki/Command_line_completion)
ls shows the contents of the current directory
cd works just like MSWin's cd, but paths use the forward slash /, not the backward slash \
./clodemojob: /bin/sh: bad interpreter: No such file or directory
then you need to type
sh ./clodemojob
instead.
For more examples of how to use the rxvt shell, see
rxvt sh under MSWin
viewtopic.php?f=28&t=1391