View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Feed parameters to external application

Gabriel wrote on Jul 29, 2009

Hi all,

I'm looking for a way to feed parameter values to an external application I need to run inside IRAF. For example, I need to feed values like:

[a given number] [enter key]
[another number] [enter key]
[yes] [enter key]
[no] [enter key]

and so on. The idea is to script this process so I don't have to type this values by hand every time.

Thanks,
Cheers!

Mike Fitzpatrick wrote on Jul 29, 2009

If I understand correctly, you just want to use a foreign command from within a script and redirect some input. To use the command you simply need to declare it as a foreign task in your login.cl/loginuser.cl file as e.g.

task $foo = $foreign


This assumes the command 'foo' is already in your unix path. You can then use if from a script as e.g.


printf ("1\n2\nyes\nno\n") | foo ()

or 

type ("myinput") | foo()

or

foo (<"myinput")


Does this answer it?

Gabriel wrote on Jul 29, 2009

Thank you very much Mike.
I finally ended up re-writing the external code, but this will surely come in handy some other time.

Cheers!

Last post on Jul 29, 2009