quantum-espresso/examples/save_results

49 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# run from directory where this script is
cd `echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
# get list of directories to be saved from command line
# if none is given, save all
if test $# = 0 ; then EXAMPLES="example*" ; else EXAMPLES="$*" ; fi
# check whether echo has the -e option
if test "`echo -e`" = "-e" ; then ECHO=echo ; else ECHO="echo -e" ; fi
# save results to reference
for dir in $EXAMPLES
do
if test -d $dir/reference/
then
# do not do anything if results/ is empty or absent
/bin/rmdir $dir/results/
if test -d $dir/results/
then
cd $dir
$ECHO "\n saving `pwd`..."
if test -d $dir/reference.old/
then
/bin/rm -r reference.old
fi
mv reference reference.old
mkdir reference
cd reference.old
if test -d CVS
then
mv CVS ../reference/
fi
files=`/bin/ls`
for file in $files
do
if test -f ../results/$file
then
mv ../results/$file ../reference
fi
done
cd ../..
$ECHO "`pwd` done...\n"
fi
fi
done
$ECHO "saving all : done"