syslog.h: Add LOG_NFACILITIES, LOG_FACMASK, LOG_FAC.
[haiku.git] / data / etc / profile
blob84e291a3bea8bcd6bc0fea5143f88dbb3e945075
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
7 if [ $? -eq 1 ] ; then
8         echo -e "\nWelcome to the Haiku shell.\n"
9         export PS1="\w> "
10 else
11         echo -e "\nSwitching to architecture `getarch`\n"
12         export PS1="[`getarch`] \w> "
15 export USER=`id -un`
16 export GROUP=`id -gn`
18 if [ -z $BE_HOST_CPU ]; then
19         . /boot/system/boot/SetupEnvironment
22 export HISTFILESIZE=500
23 export HISTCONTROL=ignoredups
25 # Locale
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"
34 alias ll="ls -lA"
35 alias la="ls -A"
36 alias m="more"
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.
51 # Chet Ramey
52 # chet@ins.CWRU.Edu
54 test -n "$KSH_VERSION" || whence()
56         local vflag= path=
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
72         if [ "$#" = "0" ] ; then
73                 echo "whence: bad argument count"
74                 return 1
75         fi
77         returnValue=0
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
109 if 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'
118 else
119         test -n "$BASH_VERSION" || PS1=$(printf '%s' "$PS1" | \
120             sed 's/\\w/$PWD/')
121         alias which='whence'
124 function dir {
125         ls -lF "$@";
128 for 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
135 done
136 unset dir
138 if [ -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