xref: /haiku/data/etc/profile (revision 922e7ba1f3228e6f28db69b0ded8f86eb32dea17)
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 LANG=`locale -l`
21export LC_CTYPE=`locale -c`
22export LC_TIME=`locale -f`
23export LC_NUMERIC=$LC_TIME
24export LC_COLLATE=$LC_TIME
25export LC_MONETARY=$LC_TIME
26export LC_MESSAGES=$LC_TIME
27
28alias ls="ls --color"
29alias ll="ls -lA"
30alias la="ls -A"
31alias m="more"
32
33shopt -s checkwinsize
34
35#
36# and now we include a few useful things...
37#
38
39#
40# An almost-ksh compatible `whence' command.  This is as hairy as it is
41# because of the desire to exactly mimic ksh.
42#
43# This depends somewhat on knowing the format of the output of the bash
44# `builtin type' command.
45#
46# Chet Ramey
47# chet@ins.CWRU.Edu
48#
49whence()
50{
51	local vflag= path=
52
53	if [ "$#" = "0" ] ; then
54		echo "whence: argument expected"
55		return 1
56	fi
57	case "$1" in
58		-v) vflag=1
59		    shift 1
60		    ;;
61		-*) echo "whence: bad option: $1"
62		    return 1
63		    ;;
64		 *) ;;
65	esac
66
67	if [ "$#" = "0" ] ; then
68		echo "whence: bad argument count"
69		return 1
70	fi
71
72	returnValue=0
73
74	for cmd
75	do
76		if [ "$vflag" ]	 ; then
77			echo $(builtin type $cmd | sed 1q)
78		else
79			path=$(builtin type -path $cmd)
80			if [ "$path" ] ; then
81				echo $path
82			else
83				case "$cmd" in
84					*/*) if [ -x "$cmd" ]; then
85							echo "$cmd"
86						else
87							returnValue=1
88					    fi
89					    ;;
90					 *) case "$(builtin type -type $cmd)" in
91						"") returnValue=1
92							;;
93						 *) echo "$cmd"
94						    ;;
95					    esac
96					    ;;
97				esac
98			fi
99		fi
100	done
101	return $returnValue
102}
103
104alias which='whence'
105
106function dir {
107	ls -lF "$@";
108}
109
110if [ -d /etc/profile.d ]; then
111  for i in /etc/profile.d/*.sh; do
112    if [ -r $i ]; then
113      . $i
114    fi
115  done
116  unset i
117fi
118