This quite a straightforward problem in shell scripting,
although there are one or two things specific to DAOPHOT
to watch out for.
Here is a C-shell script which does a FIND on all files
called pic*.sdf
in a directory, writing
output to pic*.coo
text files. It uses
shell variables interpolated into a `here document'
as the input to the program.
There are one or two things to note here:#!/bin/csh # Start up DAOPHOT. daostart # Get rid of any junk files which DAOPHOT has left lying around. rm -f *jnk.sdf # Loop over the files we're interested in. foreach file ( pic*.sdf ) # Get filename without the .sdf extension. set fileroot = $file:r # Write filename to screen. echo "***" echo "*** Processing file $file ***" echo "***" # If an old version of the output file exists, delete it. rm -f $fileroot.coo # Run DAOPHOT with the appropriate commands. daophot <<__DAOPHOT-END__ ATTACH $fileroot FIND 1,1 $fileroot Y EXIT __DAOPHOT-END__ # Get rid of scratch file that DAOPHOT has written. rm ${fileroot}jnk.sdf # End of loop. end
rm -f $fileroot.coo
is there as a safeguard: if the .coo file
exists when FIND runs, then DAOPHOT gives an extra prompt to ask
whether you want to overwrite it, and if this happened here the rest
of the commands in the file would get out of step and DAOPHOT
would get terribly confused.
If the .coo
file doesn't exist, then no harm is done.
*jnk.sdf
.
It's important at the start of this script to ensure that there
are none lying around, so that they don't get picked up by the
pic*.sdf
list which we're looping over.
If you haven't run
the script before in this directory, then the
rm -f *jnk.sdf
will not be necessary, but it doesn't hurt anyway.
The rm ${fileroot}jnk.sdf
later
on is just to prevent too
much disk space being taken up with rubbish.
source /star/etc/cshrc
is not in your
.cshrc
file, you
would need to source it here, or replace the daostart
line
with source /star/bin/daophot/daophot.csh
.
WA=0
(or do a NOMONITOR
)
to keep the size down a bit.