2004-11-03 19:36:40 +03:00
|
|
|
#
|
|
|
|
# Administrative startup for /bin/sh
|
|
|
|
# Place user customizations in /.profile
|
|
|
|
#
|
|
|
|
|
|
|
|
echo -e "\nWelcome to the Haiku shell.\n"
|
|
|
|
|
2004-11-12 19:45:14 +03:00
|
|
|
# switch to $HOME
|
|
|
|
cd
|
|
|
|
|
2008-04-26 19:56:01 +04:00
|
|
|
export PS1="\w> "
|
2004-11-03 19:36:40 +03:00
|
|
|
export HISTFILESIZE=50
|
|
|
|
|
2005-02-12 07:05:27 +03:00
|
|
|
alias ls="ls --color"
|
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
|
|
|
|
2008-12-04 00:23:04 +03:00
|
|
|
shopt -s checkwinsize
|
|
|
|
|
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
|
|
|
|
#
|
|
|
|
whence()
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
alias which='whence'
|
|
|
|
|
|
|
|
function dir {
|
|
|
|
ls -lF "$@";
|
|
|
|
}
|