[go: up one dir, main page]

Menu

[0713af]: / bin / guisdap  Maximize  Restore  History

Download this file

133 lines (122 with data), 2.6 kB

#!/bin/sh
tail=
init=
my="$HOME/gup/mygup"
mflags="-nojvm -nosplash"
usage="Usage: guisdap [-a] [-i] [-b] [-B script] [-x] [-t] [-m path] [-g file]"
if [ -z "$matlab" ]
then
	matlab="matlab"
fi
MATLAB=`$matlab -n | grep " MATLAB " | awk '{ print $NF }'`
if [ -e $MATLAB/.VERSION ]
then
	matver=`cat $MATLAB/.VERSION`
else
	matver="2012a"
fi
if [ $matver = "R13" ]
then
	MEXD=mex6
else
	MEXD=mex7
fi
mex=
str=${matver%%[A-Za-z]} ; str=${str##[A-Za-z]} ; str=${str%%.[0-9]}
if [ $matver = "R2008b" ] | [ $str -gt 2008 ]
then
	mflags="-nodesktop -nosplash"
fi

if [ -z "$TMP" ]
then
	TMP=$HOME/tmp
fi
if [ ! -d $TMP ]; then
	mkdir $TMP
fi
SHELL=/bin/sh
TZ=UTC

#find GUP
filename=$0
while [ -h $filename ]; do
	lscmd=`ls -l $filename 2>/dev/null`
	f1=`echo "$lscmd" | awk '{ print $NF }'`
	fp=`echo "$f1" | awk '{ print index($1,"/") }'`
	if [ $fp != "1" ];then
		filename=`dirname $filename`/$f1
	else
		filename=$f1
	fi
done
GUP=`dirname $filename`
if [ $GUP = . ];then GUP=$PWD; fi
GUP=`dirname $GUP`
if [ $GUP = . ];then GUP=$PWD; fi
#echo $GUP

if [ -d $GUP/$MEXD ]; then
	mex=$GUP/$MEXD:
	if [ -d $GUP/NW/$MEXD ]; then
		mex=$mex$GUP/NW/$MEXD:
	fi
fi

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=;;
		?) 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
IRIPATH=$GUP/models/iri2016

sys=`uname -s`
case $sys in
	SunOS)
		PATH=/usr/bin:/usr/local/bin:/opt/sfw/bin:/usr/sfw/bin:$GUP/bin
		LD_LIBRARY_PATH=$GUP/lib:/opt/SUNWspro/lib:/usr/local/ssl/lib
		matenv=`$matlab -n`
		if `echo $matenv | grep sol64 >/dev/null 2>&1`
		then
			#LD_LIBRARY_PATH=$GUP/lib/sparcv9:/opt/SUNWspro/lib/v9:/opt/matlab75/sys/os/sol64:/usr/local/ssl/lib
			LD_LIBRARY_PATH=$GUP/lib/sparcv9:/opt/SUNWspro/lib/v9:/usr/local/ssl/lib
		fi
		;;
	Linux)
		export HISTSIZE=0
		LD_LIBRARY_PATH=$GUP/lib:/opt/madrigal/lib
		PATH=$PATH:$GUP/bin
		unset `env | grep UTF | awk -F = '{ print $1 }'`
		;;
esac
if [ -d $GUP/NW/lib ]; then
	LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GUP/NW/lib
fi

#echo "$matlab $mflags $tail"
export TMP MATLABPATH IRIPATH PATH LD_LIBRARY_PATH SHELL TZ
$matlab $mflags $tail