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