update
[shellsnippets/shellsnippets.git] / posix / cleanenv
1 #!/bin/sh
2 # $MirOS: src/scripts/cleanenv,v 1.5 2014/09/28 19:49:56 tg Exp $
3
4 p=/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin
5
6 a1=$1
7
8 if test x"$a1" = x"/"; then
9         cd /
10         a1=-
11 fi
12
13 if test x"$a1" = x"-"; then
14         shift
15         exec /usr/bin/env -i \
16             PATH=$p HOME=/ \
17             "$@"
18 fi
19
20 exec /usr/bin/env -i \
21     PATH=$p TZ=UTC $(locale 2>/dev/null | fgrep LC_CTYPE) \
22     DISPLAY="$DISPLAY" HOME="${HOME:-/}" TERM="${TERM:-vt100}" USER="${USER}" \
23     "$@"