2 # Administrative startup for /bin/sh
3 # Place user customizations in /.profile
6 ps 2>&1 | grep -e $PPID 2>&1 | grep -e $SHELL 2>&1 | grep -q -e $PPID > /dev/null 2>&1
8 echo -e "\nWelcome to the Haiku shell.\n"
11 echo -e "\nSwitching to architecture `getarch`\n"
12 export PS1="[`getarch`] \w> "
18 if [ -z $BE_HOST_CPU ]; then
19 . /boot/system/boot/SetupEnvironment
22 export HISTFILESIZE=500
23 export HISTCONTROL=ignoredups
26 export LC_MESSAGES=`locale --message`
27 export LC_NUMERIC=`locale --format`
28 export LC_TIME=`locale --time`
29 export LC_COLLATE=$LC_MESSAGES
30 export LC_CTYPE=$LC_MESSAGES
31 export LC_MONETARY=$LC_NUMERIC
33 alias ls="ls --color=auto"
38 test -n "$BASH_VERSION" && shopt -s checkwinsize
41 # and now we include a few useful things...
45 # An almost-ksh compatible `whence' command. This is as hairy as it is
46 # because of the desire to exactly mimic ksh.
48 # This depends somewhat on knowing the format of the output of the bash
49 # `builtin type' command.
54 test -n "$KSH_VERSION" || whence()
58 if [ "$#" = "0" ] ; then
59 echo "whence: argument expected"
66 -*) echo "whence: bad option: $1"
72 if [ "$#" = "0" ] ; then
73 echo "whence: bad argument count"
81 if [ "$vflag" ] ; then
82 echo $(builtin type $cmd | sed 1q)
84 path=$(builtin type -path $cmd)
89 */*) if [ -x "$cmd" ]; then
95 *) case "$(builtin type -type $cmd)" in
109 if test -n "$KSH_VERSION"; then
111 local e=$? d=${PWD:-?}/ p=~
112 [[ $p = ?(*/) ]] || d=${d/#$p\//\~/}
113 print -nr -- "${d%/}"
116 PS1=${PS1/'\w'/'$(ps1_pwd)'}
117 alias which='whence -p'
119 test -n "$BASH_VERSION" || PS1=$(printf '%s' "$PS1" | \
128 for dir in `findpaths -Re B_FIND_PATH_DATA_DIRECTORY profile.d 2> /dev/null`; do
129 for i in $dir/*.sh; do
138 if [ -d /etc/profile.d ]; then
139 for i in /etc/profile.d/*.sh; do