2004-11-03 19:36:40 +03:00
|
|
|
#
|
|
|
|
# Administrative startup for /bin/sh
|
|
|
|
# Place user customizations in /.profile
|
|
|
|
#
|
|
|
|
|
2017-03-25 14:03:29 +03:00
|
|
|
ps 2>&1 | grep -e $PPID 2>&1 | grep -e $SHELL 2>&1 | grep -q -e $PPID > /dev/null 2>&1
|
2015-06-10 06:54:59 +03:00
|
|
|
if [ $? -eq 1 ] ; then
|
|
|
|
echo -e "\nWelcome to the Haiku shell.\n"
|
2016-09-17 19:05:39 +03:00
|
|
|
export PS1="\w> "
|
2015-06-10 06:54:59 +03:00
|
|
|
else
|
|
|
|
echo -e "\nSwitching to architecture `getarch`\n"
|
2016-09-17 19:05:39 +03:00
|
|
|
export PS1="[`getarch`] \w> "
|
2015-06-10 06:54:59 +03:00
|
|
|
fi
|
2004-11-03 19:36:40 +03:00
|
|
|
|
2010-05-11 18:55:23 +04:00
|
|
|
export USER=`id -un`
|
|
|
|
export GROUP=`id -gn`
|
|
|
|
|
2010-04-29 20:47:05 +04:00
|
|
|
if [ -z $BE_HOST_CPU ]; then
|
2010-04-29 22:15:41 +04:00
|
|
|
. /boot/system/boot/SetupEnvironment
|
2010-04-29 20:47:05 +04:00
|
|
|
fi
|
|
|
|
|
2015-03-25 01:41:52 +03:00
|
|
|
export HISTFILESIZE=500
|
2009-07-30 03:49:16 +04:00
|
|
|
export HISTCONTROL=ignoredups
|
2004-11-03 19:36:40 +03:00
|
|
|
|
2011-07-09 08:29:20 +04:00
|
|
|
# Locale
|
2012-02-24 02:06:27 +04:00
|
|
|
export LC_MESSAGES=`locale -m`
|
|
|
|
export LC_NUMERIC=`locale -f`
|
|
|
|
export LC_TIME=`locale -t`
|
|
|
|
export LC_COLLATE=$LC_MESSAGES
|
|
|
|
export LC_CTYPE=$LC_MESSAGES
|
|
|
|
export LC_MONETARY=$LC_NUMERIC
|
2011-07-09 08:29:20 +04:00
|
|
|
|
2012-09-16 07:29:42 +04:00
|
|
|
alias ls="ls --color=auto"
|
2008-10-17 01:34:15 +04:00
|
|
|
alias ll="ls -lA"
|
2008-02-25 15:52:16 +03:00
|
|
|
alias la="ls -A"
|
2008-02-25 16:19:29 +03:00
|
|
|
alias m="more"
|
2005-02-12 07:05:27 +03:00
|
|
|
|
2017-03-25 14:03:29 +03:00
|
|
|
test -n "$BASH_VERSION" && shopt -s checkwinsize
|
2008-12-04 00:23:04 +03:00
|
|
|
|
2004-11-03 19:36:40 +03:00
|
|
|
#
|
|
|
|
# and now we include a few useful things...
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
2008-10-17 01:34:15 +04:00
|
|
|
# An almost-ksh compatible `whence' command. This is as hairy as it is
|
2004-11-03 19:36:40 +03:00
|
|
|
# because of the desire to exactly mimic ksh.
|
2008-10-17 01:34:15 +04:00
|
|
|
#
|
2004-11-03 19:36:40 +03:00
|
|
|
# This depends somewhat on knowing the format of the output of the bash
|
|
|
|
# `builtin type' command.
|
|
|
|
#
|
|
|
|
# Chet Ramey
|
|
|
|
# chet@ins.CWRU.Edu
|
|
|
|
#
|
2017-03-25 14:03:29 +03:00
|
|
|
test -n "$KSH_VERSION" || whence()
|
2004-11-03 19:36:40 +03:00
|
|
|
{
|
|
|
|
local vflag= path=
|
|
|
|
|
|
|
|
if [ "$#" = "0" ] ; then
|
|
|
|
echo "whence: argument expected"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
case "$1" in
|
|
|
|
-v) vflag=1
|
|
|
|
shift 1
|
|
|
|
;;
|
|
|
|
-*) echo "whence: bad option: $1"
|
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ "$#" = "0" ] ; then
|
|
|
|
echo "whence: bad argument count"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2008-04-26 04:50:21 +04:00
|
|
|
returnValue=0
|
|
|
|
|
2004-11-03 19:36:40 +03:00
|
|
|
for cmd
|
|
|
|
do
|
|
|
|
if [ "$vflag" ] ; then
|
|
|
|
echo $(builtin type $cmd | sed 1q)
|
|
|
|
else
|
|
|
|
path=$(builtin type -path $cmd)
|
|
|
|
if [ "$path" ] ; then
|
|
|
|
echo $path
|
|
|
|
else
|
|
|
|
case "$cmd" in
|
2008-04-26 04:50:21 +04:00
|
|
|
*/*) if [ -x "$cmd" ]; then
|
|
|
|
echo "$cmd"
|
|
|
|
else
|
|
|
|
returnValue=1
|
2004-11-03 19:36:40 +03:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*) case "$(builtin type -type $cmd)" in
|
2008-04-26 04:50:21 +04:00
|
|
|
"") returnValue=1
|
|
|
|
;;
|
2004-11-03 19:36:40 +03:00
|
|
|
*) echo "$cmd"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2008-04-26 04:50:21 +04:00
|
|
|
return $returnValue
|
2004-11-03 19:36:40 +03:00
|
|
|
}
|
|
|
|
|
2017-03-25 14:03:29 +03:00
|
|
|
if test -n "$KSH_VERSION"; then
|
|
|
|
ps1_pwd() {
|
|
|
|
local e=$? d=${PWD:-?}/ p=~
|
|
|
|
[[ $p = ?(*/) ]] || d=${d/#$p\//\~/}
|
|
|
|
print -nr -- "${d%/}"
|
|
|
|
return $e
|
|
|
|
}
|
|
|
|
PS1=${PS1/'\w'/'$(ps1_pwd)'}
|
|
|
|
alias which='whence -p'
|
|
|
|
else
|
|
|
|
test -n "$BASH_VERSION" || PS1=$(printf '%s' "$PS1" | \
|
|
|
|
sed 's/\\w/$PWD/')
|
|
|
|
alias which='whence'
|
|
|
|
fi
|
2004-11-03 19:36:40 +03:00
|
|
|
|
|
|
|
function dir {
|
|
|
|
ls -lF "$@";
|
|
|
|
}
|
2009-04-18 02:05:11 +04:00
|
|
|
|
2013-12-05 02:20:35 +04:00
|
|
|
for dir in `findpaths -Re B_FIND_PATH_DATA_DIRECTORY profile.d 2> /dev/null`; do
|
|
|
|
for i in $dir/*.sh; do
|
|
|
|
if [ -r $i ]; then
|
|
|
|
. $i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
unset i
|
|
|
|
done
|
|
|
|
unset dir
|
|
|
|
|
2011-06-20 01:19:36 +04:00
|
|
|
if [ -d /etc/profile.d ]; then
|
|
|
|
for i in /etc/profile.d/*.sh; do
|
|
|
|
if [ -r $i ]; then
|
|
|
|
. $i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
unset i
|
2009-04-18 02:05:11 +04:00
|
|
|
fi
|