-
Notifications
You must be signed in to change notification settings - Fork 0
/
eclipse-gtk2.sh
executable file
·54 lines (46 loc) · 1.01 KB
/
eclipse-gtk2.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Based on https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
# and my own boilerplate https://github.com/Szymon2603/auxiliary-scripts
# Main script description
MAIN_DESC="Run Eclipse with GTK2"
# Description for help and invoke errors
PARAMETERS_DESC="Parameters description:\n\
-d|--dir - directory with eclipse\n\
-h|--help - help message\n"
export SWT_GTK3=0
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-d|--dir)
DIR="$2"
shift
;;
-h|--help)
echo -e $MAIN_DESC
echo -e $PARAMETERS_DESC
exit 0
;;
*)
echo "Wrong parameter! [$1 $2]"
echo -e $PARAMETERS_DESC
exit 1
;;
esac
# Past argument or value
shift
done
set -e
# Run Eclipse
if ! [ -z ${DIR+x} ]; then
echo "Run from directory $DIR"
$DIR/eclipse
else
if ! [ -z ${ECLIPSE_HOME+x} ]; then
echo "Run from $ECLIPSE_HOME directory"
$ECLIPSE_HOME/eclipse
else
echo "ECLIPSE_HOME is unset! You have to pass directory via -d|--dir parameter!"
exit 1
fi
fi