-
Notifications
You must be signed in to change notification settings - Fork 20
/
jmol.sh
39 lines (34 loc) · 849 Bytes
/
jmol.sh
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
#!/bin/sh
# Collect -D & -m options as java arguments
command=java
while [ `echo $1 | egrep '^-D|^-m' | wc -l` != 0 ]; do
command="$command $1"
shift
done
# Determine installation location
if [ "$JMOL_HOME" = "" ]; then
binDir=${0%/*}
if [ "$binDir" = "$0" ]; then
# Ran from local directory
binDir=$PWD
fi
# Resolve symlinks.
program="$0"
while [ -L "$program" ]; do
ls=`/bin/ls -ld "$program"`
link=`/usr/bin/expr "$ls" : '.*-> \(.*\)$'`
if /usr/bin/expr "$link" : '.*/.*' > /dev/null; then
program="$link"
else
program="`/usr/bin/dirname $program`/$link"
fi
done
binDir=`dirname $program`
fi
JMOL_HOME=${JMOL_HOME:-$binDir}
libDir=${JMOL_HOME}/jars
if [ ! -e ${JMOL_HOME}/Jmol.jar ]; then
echo "Jmol could not find its installed files."
exit
fi
$command -Djmol.home="$JMOL_HOME" -jar ${JMOL_HOME}/Jmol.jar "$@"