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