author | blanchet |
Tue, 24 Apr 2012 09:47:40 +0200 | |
changeset 47717 | a0125644ccff |
parent 47674 | cdf95042e09c |
child 61294 | 2d3d26e9b191 |
permissions | -rwxr-xr-x |
10555 | 1 |
#!/usr/bin/env bash |
2296 | 2 |
# |
9788 | 3 |
# Author: Markus Wenzel, TU Muenchen |
2307 | 4 |
# |
2734 | 5 |
# DESCRIPTION: get values from Isabelle settings environment |
2307 | 6 |
|
2296 | 7 |
|
2733 | 8 |
## diagnostics |
9 |
||
10511 | 10 |
PRG="$(basename "$0")" |
2296 | 11 |
|
12 |
function usage() |
|
13 |
{ |
|
14 |
echo |
|
28650 | 15 |
echo "Usage: isabelle $PRG [OPTIONS] [VARNAMES ...]" |
2296 | 16 |
echo |
2733 | 17 |
echo " Options are:" |
18 |
echo " -a display complete environment" |
|
19 |
echo " -b print values only (doesn't work for -a)" |
|
31497 | 20 |
echo " -d FILE dump complete environment to FILE" |
21 |
echo " (null terminated entries)" |
|
2733 | 22 |
echo |
23 |
echo " Get value of VARNAMES from the Isabelle settings." |
|
2296 | 24 |
echo |
25 |
exit 1 |
|
26 |
} |
|
27 |
||
28 |
||
2733 | 29 |
## process command line |
30 |
||
31 |
# options |
|
32 |
||
33 |
ALL="" |
|
34 |
BASE="" |
|
31497 | 35 |
DUMP="" |
2733 | 36 |
|
31497 | 37 |
while getopts "abd:" OPT |
2733 | 38 |
do |
39 |
case "$OPT" in |
|
40 |
a) |
|
41 |
ALL=true |
|
42 |
;; |
|
43 |
b) |
|
44 |
BASE=true |
|
45 |
;; |
|
31497 | 46 |
d) |
47 |
DUMP="$OPTARG" |
|
48 |
;; |
|
2733 | 49 |
\?) |
50 |
usage |
|
51 |
;; |
|
52 |
esac |
|
53 |
done |
|
54 |
||
55 |
shift $(($OPTIND - 1)) |
|
56 |
||
57 |
||
58 |
# args |
|
59 |
||
9788 | 60 |
[ -n "$ALL" -a "$#" -ne 0 ] && usage |
2733 | 61 |
|
62 |
||
2296 | 63 |
## main |
64 |
||
2733 | 65 |
if [ -n "$ALL" ]; then |
17226 | 66 |
env |
2733 | 67 |
else |
9788 | 68 |
for VAR in "$@" |
2733 | 69 |
do |
70 |
if [ -n "$BASE" ]; then |
|
71 |
eval "echo \$$VAR" |
|
72 |
else |
|
73 |
eval "echo $VAR=\$$VAR" |
|
74 |
fi |
|
75 |
done |
|
76 |
fi |
|
31497 | 77 |
|
78 |
if [ -n "$DUMP" ]; then |
|
47674
cdf95042e09c
more robust handling of PATH vs PATH_JVM -- required for cold start of Cygwin from Windows (e.g. Isabelle.exe);
wenzelm
parents:
31497
diff
changeset
|
79 |
export PATH_JVM="$(jvmpath "$PATH")" |
31497 | 80 |
exec perl -w -e 'for $key (keys %ENV) { print $key, "=", $ENV{$key}, "\x00"; }' > "$DUMP" |
81 |
fi |
|
82 |