-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBLPGSolver-DebugVersion
More file actions
executable file
·56 lines (47 loc) · 1.17 KB
/
Copy pathBLPGSolver-DebugVersion
File metadata and controls
executable file
·56 lines (47 loc) · 1.17 KB
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
#!/bin/bash
# a shell function to resolve symbolic links
# taken from
# http://sites.google.com/site/jdisnard/realpath
#
real_path () {
OIFS=$IFS
IFS='/'
for I in $1
do
# Resolve relative path punctuation.
if [ "$I" = "." ] || [ -z "$I" ]
then continue
elif [ "$I" = ".." ]
then FOO="${FOO%%/${FOO##*/}}"
continue
else FOO="${FOO}/${I}"
fi
# Dereference symbolic links.
if [ -h "$FOO" ] && [ -x "/bin/ls" ]
then IFS=$OIFS
set `/bin/ls -l "$FOO"`
while shift ;
do
if [ "$1" = "->" ]
then FOO=$2
shift $#
break
fi
done
fi
done
IFS=$OIFS
echo "$FOO"
}
dir_name () {
echo "${1%/*}"
}
# however, the following doesn't work at all
# script_dir="$(dir_name "$(real_path ${BASH_SOURCE[0]})")"
# faulty workaround
# script_dir="$(dirname ${BASH_SOURCE[0]})"
# solution using perl
script_name=`perl -e 'use Cwd "abs_path";print abs_path(shift)' $0`
#echo $script_name
script_dir="$(dirname ${script_name})"
LD_LIBRARY_PATH=$script_dir/lib:$LD_LIBRARY_PATH $script_dir/bin/BLPGSolver-Debug "$@"