View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

script command

kwkchan wrote on Dec 06, 2009

Hi! I have another question, in my script I am inputing a file and I want to include a command so that my script will do a certain thing if the input file is a .txt file and do something else if the input file is a .fit file. Does anyone know what the command is?

Mike Fitzpatrick wrote on Dec 06, 2009

You can use something like


fname = "foo.fit"
len = strlen (fname)
extn = substr (fname, len-2, len)
if (extn == "fit") {
    ....something
} else if (extn == "txt") {
    ....something else
}


Another way to handle it is just to have separate parameters for images and text files and key off of whether the parameter is set.

-Mike

Last post on Dec 06, 2009