View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

script variables

sw wrote on Apr 09, 2008

Hi,

Hopefully this will be an easy question to answer if nobody minds taking a few minutes to read. I'm writing a little IRAF script and have a little problem, which essentially boils down to the following.

I have the variables image and coofile. I have set image to be sa95.fits and want coofile to be sa95.fits.coo , with the sa95.fits part coming from the image variable and the .coo bit being just text. Basically, my question is how do I set the value of a variable to be that of another variable, plus some text?


string image
string coofile

image = "sa95.fits"

coofile = image #want this to be image.coo



Thanks a lot!

Sam

Mike Fitzpatrick wrote on Apr 09, 2008

Try:


image = "sa95.fits"
coofile = image // ".coo"


The '//' is a string concatenation operator.

-Mike

sw wrote on Apr 09, 2008

Brilliant, thanks Mike!!

You were quicker than a speeding bullet. I should have posted here straight away instead of spending hours reading manuals from 1982!!

Last post on Apr 09, 2008