update
[shellsnippets/shellsnippets.git] / posix / cleanenv
index 978fa80..a70240b 100644 (file)
@@ -1,17 +1,23 @@
 #!/bin/sh
-# $MirOS: src/scripts/cleanenv,v 1.4+notz 2009/03/29 13:04:20 tg Exp $
-#-
-# Not complicated enough for copyright.
+# $MirOS: src/scripts/cleanenv,v 1.5 2014/09/28 19:49:56 tg Exp $
 
 p=/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin
 
-if test x"$1" = x"-"; then
+a1=$1
+
+if test x"$a1" = x"/"; then
+       cd /
+       a1=-
+fi
+
+if test x"$a1" = x"-"; then
        shift
        exec /usr/bin/env -i \
            PATH=$p HOME=/ \
            "$@"
 fi
+
 exec /usr/bin/env -i \
-    PATH=$p $(locale 2>/dev/null | fgrep LC_CTYPE) \
+    PATH=$p TZ=UTC $(locale 2>/dev/null | fgrep LC_CTYPE) \
     DISPLAY="$DISPLAY" HOME="${HOME:-/}" TERM="${TERM:-vt100}" USER="${USER}" \
     "$@"