1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#! /usr/bin/env tcsh
set ddir = nifti_regress_data
set prog = nifti_tool # might allow this to change
set grind = 0 # do we run with valgrind?
if ( $#argv > 0 ) then
if ( "$argv[1]" == "-grind" ) then
set grind = 1
else
echo "usage: `basename $0` [-grind]"
exit
endif
endif
# make sure $prog at least exists
# $prog -ver >& /dev/null
# if ( $status ) then
# echo "missing program '$prog' (needs to be in PATH)"
# exit
# endif
# set date and output dir (based on grind)
set date = `date +%Y_%m_%d_%H%M`
if ( $grind ) then
set odir = vg_results_${prog}_${date}
else
set odir = results_${prog}_${date}
endif
# note command files (in commands dir)
if ( ! -d commands ) then
echo "** failure: missing commands directory"
exit
endif
cd commands ; set cfiles = ( c* ) ; cd ..
if ( $#cfiles < 1 ) then
echo "** failure: no command files found in 'commands'"
exit
endif
# create the output directory
if ( -e $odir ) then
echo "** failure: output directory '$odir' already exists"
exit
endif
mkdir $odir
if ( $status ) then
echo "** failure: output directory '$odir' already exists"
exit
endif
# copy data files into output dir
cp $ddir/* $odir
cd $odir
# now begin the work
echo "++ using `which $prog` ..."
if ( $grind ) then
alias $prog "valgrind --leak-resolution=high --leak-check=full $prog"
endif
foreach cfile ( $cfiles )
echo -n $cfile ...
echo "--------------------------------------------------------" > e.$cfile
cat ../commands/$cfile >> e.$cfile
echo "" >> e.$cfile
echo "--------------------------" >> e.$cfile
echo "" >> e.$cfile
source ../commands/$cfile >>& e.$cfile # to keep alias
echo done
end
|