1# try to find a better shell, especially on Solaris
2
3PATH="$PATH:/usr/local/bin:/opt/csw/bin:/opt/local/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/dt/bin:/usr/bin:/bin"
4
5# debian lintian bitches if /usr/bin/ash is used instead of /bin/ash
6if [ -f /etc/debian_version ]; then
7    PATH=$(echo "$PATH" | sed 's,/usr/bin,/bin:/usr/bin,')
8fi
9
10export PATH
11
12if [ -z "$POSIX_SHELL" ]; then
13	if command -v ash >/dev/null; then
14		POSIX_SHELL=ash
15	elif command -v dash >/dev/null; then
16		POSIX_SHELL=dash
17	elif command -v ksh >/dev/null; then
18		POSIX_SHELL=ksh
19	elif [ -x /usr/xpg4/bin/sh ]; then
20		POSIX_SHELL=/usr/xpg4/bin/sh
21	elif command -v dtksh >/dev/null; then
22		POSIX_SHELL=dtksh
23	elif command -v ksh93 >/dev/null; then
24		POSIX_SHELL=ksh93
25	elif command -v bash >/dev/null; then
26		POSIX_SHELL=bash
27	elif command -v zsh >/dev/null; then
28		POSIX_SHELL=zsh
29	fi
30
31	if [ ! -z "$POSIX_SHELL" ]; then
32		export POSIX_SHELL
33		exec "$POSIX_SHELL" "$0" "$@"
34	else
35		POSIX_SHELL=/bin/sh # hope for the best
36		export POSIX_SHELL
37	fi
38fi
39
40# hopefully we're now POSIX.
41