lib/Tools/getenv
changeset 31497 5333aa739082
parent 29143 72c960b2b83e
child 47674 cdf95042e09c
     1.1 --- a/lib/Tools/getenv	Sat Jun 06 23:43:07 2009 +0200
     1.2 +++ b/lib/Tools/getenv	Sun Jun 07 19:07:05 2009 +0200
     1.3 @@ -17,6 +17,8 @@
     1.4    echo "  Options are:"
     1.5    echo "    -a           display complete environment"
     1.6    echo "    -b           print values only (doesn't work for -a)"
     1.7 +  echo "    -d FILE      dump complete environment to FILE"
     1.8 +  echo "                 (null terminated entries)"
     1.9    echo
    1.10    echo "  Get value of VARNAMES from the Isabelle settings."
    1.11    echo
    1.12 @@ -30,8 +32,9 @@
    1.13  
    1.14  ALL=""
    1.15  BASE=""
    1.16 +DUMP=""
    1.17  
    1.18 -while getopts "ab" OPT
    1.19 +while getopts "abd:" OPT
    1.20  do
    1.21    case "$OPT" in
    1.22      a)
    1.23 @@ -40,6 +43,9 @@
    1.24      b)
    1.25        BASE=true
    1.26        ;;
    1.27 +    d)
    1.28 +      DUMP="$OPTARG"
    1.29 +      ;;
    1.30      \?)
    1.31        usage
    1.32        ;;
    1.33 @@ -68,3 +74,8 @@
    1.34      fi
    1.35    done
    1.36  fi
    1.37 +
    1.38 +if [ -n "$DUMP" ]; then
    1.39 +  exec perl -w -e 'for $key (keys %ENV) { print $key, "=", $ENV{$key}, "\x00"; }' > "$DUMP"
    1.40 +fi
    1.41 +