1#
2# Administrative startup for /bin/sh
3# Place user customizations in /.profile
4#
5
6echo -e "\nWelcome to the Haiku shell.\n"
7
8export USER=`id -un`
9export GROUP=`id -gn`
10
11if [ -z $BE_HOST_CPU ]; then
12	. /boot/system/boot/SetupEnvironment
13fi
14
15export PS1="\w> "
16export HISTFILESIZE=50
17export HISTCONTROL=ignoredups
18
19# Locale
20export LC_MESSAGES=`locale -m`
21export LC_NUMERIC=`locale -f`
22export LC_TIME=`locale -t`
23export LC_COLLATE=$LC_MESSAGES
24export LC_CTYPE=$LC_MESSAGES
25export LC_MONETARY=$LC_NUMERIC
26
27alias ls="ls --color=auto"
28alias ll="ls -lA"
29alias la="ls -A"
30alias m="more"
31
32shopt -s checkwinsize
33
34#
35# and now we include a few useful things...
36#
37
38#
39# An almost-ksh compatible `whence' command.  This is as hairy as it is
40# because of the desire to exactly mimic ksh.
41#
42# This depends somewhat on knowing the format of the output of the bash
43# `builtin type' command.
44#
45# Chet Ramey
46# chet@ins.CWRU.Edu
47#
48whence()
49{
50	local vflag= path=
51
52	if [ "$#" = "0" ] ; then
53		echo "whence: argument expected"
54		return 1
55	fi
56	case "$1" in
57		-v) vflag=1
58		    shift 1
59		    ;;
60		-*) echo "whence: bad option: $1"
61		    return 1
62		    ;;
63		 *) ;;
64	esac
65
66	if [ "$#" = "0" ] ; then
67		echo "whence: bad argument count"
68		return 1
69	fi
70
71	returnValue=0
72
73	for cmd
74	do
75		if [ "$vflag" ]	 ; then
76			echo $(builtin type $cmd | sed 1q)
77		else
78			path=$(builtin type -path $cmd)
79			if [ "$path" ] ; then
80				echo $path
81			else
82				case "$cmd" in
83					*/*) if [ -x "$cmd" ]; then
84							echo "$cmd"
85						else
86							returnValue=1
87					    fi
88					    ;;
89					 *) case "$(builtin type -type $cmd)" in
90						"") returnValue=1
91							;;
92						 *) echo "$cmd"
93						    ;;
94					    esac
95					    ;;
96				esac
97			fi
98		fi
99	done
100	return $returnValue
101}
102
103alias which='whence'
104
105function dir {
106	ls -lF "$@";
107}
108
109if [ -d /etc/profile.d ]; then
110  for i in /etc/profile.d/*.sh; do
111    if [ -r $i ]; then
112      . $i
113    fi
114  done
115  unset i
116fi
117