1# 2# Administrative startup for /bin/sh 3# Place user customizations in /.profile 4# 5 6ps 2>&1 | grep -e $PPID 2>&1 | grep -e $SHELL 2>&1 | 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 38test -n "$BASH_VERSION" && shopt -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# 54test -n "$KSH_VERSION" || whence() 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 109if test -n "$KSH_VERSION"; then 110 ps1_pwd() { 111 local e=$? d=${PWD:-?}/ p=~ 112 [[ $p = ?(*/) ]] || d=${d/#$p\//\~/} 113 print -nr -- "${d%/}" 114 return $e 115 } 116 PS1=${PS1/'\w'/'$(ps1_pwd)'} 117 alias which='whence -p' 118else 119 test -n "$BASH_VERSION" || PS1=$(printf '%s' "$PS1" | \ 120 sed 's/\\w/$PWD/') 121 alias which='whence' 122fi 123 124function dir { 125 ls -lF "$@"; 126} 127 128for dir in `findpaths -Re B_FIND_PATH_DATA_DIRECTORY profile.d 2> /dev/null`; do 129 for i in $dir/*.sh; do 130 if [ -r $i ]; then 131 . $i 132 fi 133 done 134 unset i 135done 136unset dir 137 138if [ -d /etc/profile.d ]; then 139 for i in /etc/profile.d/*.sh; do 140 if [ -r $i ]; then 141 . $i 142 fi 143 done 144 unset i 145fi 146