Unix commands in iraf.
douglas brenner wrote on Jul 22, 2009
I know I can do this
cd "tmp"
but can I do something like this
string dirname
dirname = "tmp"
cd dirname ?
thanks
cd "tmp"
but can I do something like this
string dirname
dirname = "tmp"
cd dirname ?
thanks
Jason Quinn wrote on Jul 22, 2009
From within IRAF you can run UNIX command by escaping them with an exclaimation mark (aka a "bang").
For example "!ls -l *.fits" would give you a long listing of all the fits files.
If you look in your default login.cl file, you'll see some examples of how to define "foreign" tasks. That's probably what you are after.
Jason
For example "!ls -l *.fits" would give you a long listing of all the fits files.
If you look in your default login.cl file, you'll see some examples of how to define "foreign" tasks. That's probably what you are after.
Jason
Mike Fitzpatrick wrote on Jul 22, 2009
Try
Foreign commands pass their arguments directly and the unix 'cd' doesn't know from the iraf 'dirname' value, but if you use "program mode" as above then the CL interprets the value ('tmp') before executing the command. Note this works with iraf logicals as well, e.g.
will put you /tmp, but if dirname="tmp" it will put you in the 'tmp' subdirectory of where you currently are.
-Mike
cd (dirname)Foreign commands pass their arguments directly and the unix 'cd' doesn't know from the iraf 'dirname' value, but if you use "program mode" as above then the CL interprets the value ('tmp') before executing the command. Note this works with iraf logicals as well, e.g.
cd ("tmp$")will put you /tmp, but if dirname="tmp" it will put you in the 'tmp' subdirectory of where you currently are.
-Mike
nwj781 wrote on Jul 22, 2009
try this
the double slash just means put the string variable after the explicitly defined string. Any variable you want can be put into the command string as follows:
"......"//variablename//"......."
string command
string dirname
dirname = "tmp"
command = "cd "//dirname
print(command) | cl
the double slash just means put the string variable after the explicitly defined string. Any variable you want can be put into the command string as follows:
"......"//variablename//"......."
douglas brenner wrote on Jul 22, 2009
Thanks guys.
Last post on Jul 22, 2009