View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

calling a cl command from within a C-shell script

RhEvans41 wrote on May 28, 2008

I have a shell script which creates a file which I then try to get IRAF to
execute. The script used to work fine, but I have not used it in over 12
months and now I find it does not work. I am running Version 2.14 on a
Mac.

The relevant part of the script is the following

--------

#Create iraf script to check status of keyword "reduce", which will
#exist and have a value of 1 if the files have already been run
#through this script
rm -f /tmp/reducestatus$$

cat > /tmp/cl.reduce$$ << EOF
#
cd $current
hselect @objectlist "\$I,reduce" yes > /tmp/reducestatus$$
logout

.
wq
EOF

#Now run this script
cd $irafdir
cl < /tmp/cl.reduce$$ > /tmp/cl.logreduce$$

-----

Whereas before the file /tmp/reducestatus$$ would be created, it is now
not creating it. The cl.logreduce$$ file is not very informative, all it
has in it is

>cat cl.logreduce
setting terminal type to xgterm...

NOAO/IRAFNET PC-IRAF Revision 2.14 Fri Nov 30 15:27:05 MST 2007
This is the RELEASED version of IRAF V2.14 supporting PC systems.

Welcome to IRAF. To list the available commands, type ? or ??. To get
detailed information about a command, type `help <command>'. To run a
command or load a package, type its name. Type `bye' to exit a
package, or `logout' to get out of the CL. Type `news' to find out
what is new in the version of the system you are using.

Visit http://iraf.net if you have questions or to report problems.

The following commands or packages are currently defined:

ace. dimsum. guiapps. mxtools. plot. system.
color. fitsutil. images. nlocal. proto. tables.
ctio. fuzzy. language. nmisc. softools. utilities.
dataio. gemini. lists. noao. spectime. vol.
dbms. gmisc. mscred. obsolete. stsdas. websvc.

ecl> ERROR: use `logout' to log out of the CL
ecl> ERROR: use `logout' to log out of the CL
ecl> ERROR: use `logout' to log out of the CL
ecl> ERROR: use `logout' to log out of the CL
ecl> ERROR: use `logout' to log out of the CL
ecl> ERROR: use `logout' to log out of the CL
ecl> ERROR: use `logout' to log out of the CL
ecl> ERROR: use `logout' to log out of the CL
ecl> teaching >;24;80t

-----

Unfortunately I am stumped as to what is going on.... Any ideas what part
is now not working?

Mike Fitzpatrick wrote on May 28, 2008

In v2.14 we switched to the ECL as the default, this uses the readline interface to permit the history editing and fix the backspace problem, but has a side-effect with host scripts such as this. Specifically, if the current directory contain a login.cl file the 'stty xgterm' command is causing the problem.

Try running the script *without* a login.cl file in the current directory, or to get the old CL execute using

% cl -old < /tmp/cl.reduce$$ > /tmp/cl.logreduce$$


Otherwise, I wouldn't expect your script to work since the '@objectlist' would require a CL variable 'objectlist' to be present. Since you say 'relevant part of the script' I'll assume for now this is set elsewhere. Anyway, hope this helps.

Cheers,
-Mike

Last post on May 28, 2008