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