10555
|
1 |
#!/usr/bin/env bash
|
2296
|
2 |
#
|
2307
|
3 |
# $Id$
|
9788
|
4 |
# Author: Markus Wenzel, TU Muenchen
|
2307
|
5 |
#
|
2734
|
6 |
# DESCRIPTION: get values from Isabelle settings environment
|
2307
|
7 |
|
2296
|
8 |
|
2733
|
9 |
## diagnostics
|
|
10 |
|
10511
|
11 |
PRG="$(basename "$0")"
|
2296
|
12 |
|
|
13 |
function usage()
|
|
14 |
{
|
|
15 |
echo
|
2733
|
16 |
echo "Usage: $PRG [OPTIONS] [VARNAMES ...]"
|
2296
|
17 |
echo
|
2733
|
18 |
echo " Options are:"
|
|
19 |
echo " -a display complete environment"
|
|
20 |
echo " -b print values only (doesn't work for -a)"
|
|
21 |
echo
|
|
22 |
echo " Get value of VARNAMES from the Isabelle settings."
|
2296
|
23 |
echo
|
|
24 |
exit 1
|
|
25 |
}
|
|
26 |
|
|
27 |
|
2733
|
28 |
## process command line
|
|
29 |
|
|
30 |
# options
|
|
31 |
|
|
32 |
ALL=""
|
|
33 |
BASE=""
|
|
34 |
|
|
35 |
while getopts "ab" OPT
|
|
36 |
do
|
|
37 |
case "$OPT" in
|
|
38 |
a)
|
|
39 |
ALL=true
|
|
40 |
;;
|
|
41 |
b)
|
|
42 |
BASE=true
|
|
43 |
;;
|
|
44 |
\?)
|
|
45 |
usage
|
|
46 |
;;
|
|
47 |
esac
|
|
48 |
done
|
|
49 |
|
|
50 |
shift $(($OPTIND - 1))
|
|
51 |
|
|
52 |
|
|
53 |
# args
|
|
54 |
|
9788
|
55 |
[ -n "$ALL" -a "$#" -ne 0 ] && usage
|
2733
|
56 |
|
|
57 |
|
2296
|
58 |
## main
|
|
59 |
|
2733
|
60 |
if [ -n "$ALL" ]; then
|
|
61 |
env | sort
|
|
62 |
else
|
9788
|
63 |
for VAR in "$@"
|
2733
|
64 |
do
|
|
65 |
if [ -n "$BASE" ]; then
|
|
66 |
eval "echo \$$VAR"
|
|
67 |
else
|
|
68 |
eval "echo $VAR=\$$VAR"
|
|
69 |
fi
|
|
70 |
done
|
|
71 |
fi
|