xselect_test (version 1.5)
You can also look at:
#! /usr/bin/ksh
###########################################################################
#
#
# SYNTAX: xselect_test code caller stdout stderr
#
# DESCRIPTION: This utility handles error checking and cleanup after
# DESCRIPTION: an xselect run. Nte, the command file if any is not
# DESCRIPTION: removed by this utility.
#
# VERSION: 1.5
#
# HISTORY: 0.0 -> 1.0 8/23/96
# HISTORY: Now removes flookup.par
# HISTORY:
# HISTORY: 1.0 -> 1.1 10/17/96
# HISTORY: now removes grppha.par, rbnpha.par, and fixrev0pha.par
# HISTORY:
# HISTORY: 1.1 -> 1.2 12/23/96
# HISTORY: Now remove saextrct.par (needed for MPC mode)
# HISTORY: Also, don't print stderr if all it contains is rm -f statements
# HISTORY: 12/26/96 Now log and remove *_xsel.run files. These are the
# HISTORY: actual script files which are left behind by xselect when
# HISTORY: modified to quit on non-zero status. Standard xselect removes
# HISTORY: these automatically before quitting
# HISTORY: 1/7/97 Now remove "% completed" lines from the stdout.
# HISTORY:
# HISTORY: 1.2 ->1.3 1/22/97
# HISTORY: Commented out the code which reports the xsel_run files since these
# HISTORY: produce lines which are too long for FITS wrapping.
# HISTORY:
# HISTORY: 1.3 -> 1.4 1/26/97
# HISTORY: put back a rm -f *_xsel.run to compensate for the last change
# HISTORY: 2/6/97 now ignore code 1 and code 246. Also began handling stderr
# HISTORY: through the call to ftool_test after removing "rm -f" lines
# HISTORY:
# HISTORY: 1.4 -> 1.5 4/28/97
# HISTORY: now remove *_timefile.asc
##############################################################################
#DEBUG=1
code=$1
caller=$2
stdout=$3
stderr=$4
###############################
# remove unwanted output lines
###############################
rm -f zlog$$.tmp
grep -v "% completed" $stdout >zlog$$.tmp
mv zlog$$.tmp $stdout
grep -v "^rm -f" $stderr >zlog$$.tmp
mv zlog$$.tmp $stderr
##########################################
# don't worry about code 1 or code 246
##########################################
if [ $code -eq 1 -o $code -eq 246 ]; then
if [ ! -s $stderr ]; then
code=0
fi
fi
$UTIL/ftool_test xselect $code $caller 2 $stdout $stderr
########################
# clean up various files
########################
rm -f $stderr
rm -f xsel.log
rm -f xsel13.par
rm -f *_display.def
rm -f *_files.tmp
rm -f *_obscat.tmp
rm -f *_obslist.def
rm -f *_*.xsl
rm -f cleansis.par
rm -f extractor.par
rm -f fappend.par
rm -f fdump.par
rm -f ffilecat.par
rm -f fhelp.par
rm -f maketime.par
rm -f mgtime.par
rm -f flookup.par
rm -f grppha.par
rm -f rbnpha.par
rm -f fixrev0pha.par
rm -f saextrct.par
rm -f *_xsel.run
rm -f *_timefile.asc
exit 0