guisdap Code
Brought to you by:
haggstrom
#!/bin/sh
tail=
init=
mex=
my="$HOME/gup/mygup"
mflags="-nodesktop -nosplash"
usage="Usage: guisdap [-a] [-i] [-b] [-B script] [-x] [-t] [-m path] [-g file]"
if [ -z "$matlab" ]
then
matlab="matlab"
fi
if [ -z "$TMP" ]
then
TMP=$HOME/tmp
fi
if [ ! -d $TMP ]; then
mkdir $TMP
fi
SHELL=/bin/sh
#find GUP
filename=`readlink -f $0`
GUP=`dirname $filename`
GUP=`dirname $GUP`
#echo $GUP
while getopts aibB:xtm:g: flag
do
case $flag in
a) tail="-r analyse";;
i) init=":$GUP/init";;
b) tail="-r go_on(-1) >/dev/null 2>&1 &"
mflags=
matlab="nohup $matlab"
;;
B) tail="-r go_on('$OPTARG') >$TMP/$OPTARG 2>&1 &"
mflags=
matlab="nohup $matlab"
;;
g) tail="-r go_on('$OPTARG')";;
m) my="$OPTARG";;
t) mflags=;;
x) mex=$GUP/mex:;;
?) echo $usage
exit 2;;
esac
done
shift `expr $OPTIND - 1`
if [ -z "$mflags" ];then
unset DISPLAY
mflags="-nodisplay"
fi
if [ "$*" != "" ];then
mflags=$*
fi
if [ ! -d $my ];then
my=
else
my=$my:
fi
MATLABPATH=$my$mex$GUP/anal$init
sys=`uname -s`
case $sys in
Linux)
export HISTSIZE=0
unset `env | grep UTF | awk -F = '{ print $1 }'`
;;
esac
if [ -d /opt/madrigal/lib ]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/madrigal/lib
fi
#echo "$matlab $mflags $tail"
export TMP MATLABPATH SHELL
$matlab $mflags $tail