xref: /haiku/data/etc/profile (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1#
2# Administrative startup for /bin/sh
3# Place user customizations in /.profile
4#
5
6echo -e "\nWelcome to the Haiku shell.\n"
7
8# switch to $HOME
9cd
10
11export PS1="\w>"
12export HISTFILESIZE=50
13
14bind '"\e[2~":paste-from-clipboard'
15bind '"\e[3~":delete-char'
16bind '"\e[4~":end-of-line'
17bind '"\e[5~":history-search-forward'
18bind '"\e[6~":history-search-backward'
19
20alias ls="ls --color"
21
22#
23# and now we include a few useful things...
24#
25
26#
27# An almost-ksh compatible `whence' command.  This is as hairy as it is
28# because of the desire to exactly mimic ksh.
29#
30# This depends somewhat on knowing the format of the output of the bash
31# `builtin type' command.
32#
33# Chet Ramey
34# chet@ins.CWRU.Edu
35#
36whence()
37{
38	local vflag= path=
39
40	if [ "$#" = "0" ] ; then
41		echo "whence: argument expected"
42		return 1
43	fi
44	case "$1" in
45		-v) vflag=1
46		    shift 1
47		    ;;
48		-*) echo "whence: bad option: $1"
49		    return 1
50		    ;;
51		 *) ;;
52	esac
53
54	if [ "$#" = "0" ] ; then
55		echo "whence: bad argument count"
56		return 1
57	fi
58
59	for cmd
60	do
61		if [ "$vflag" ]	 ; then
62			echo $(builtin type $cmd | sed 1q)
63		else
64			path=$(builtin type -path $cmd)
65			if [ "$path" ] ; then
66				echo $path
67			else
68				case "$cmd" in
69					/*) if [ -x "$cmd" ]; then
70						echo "$cmd"
71					    fi
72					    ;;
73					 *) case "$(builtin type -type $cmd)" in
74						"") ;;
75						 *) echo "$cmd"
76						    ;;
77					    esac
78					    ;;
79				esac
80			fi
81		fi
82	done
83	return 0
84}
85
86alias which='whence'
87
88function dir {
89	ls -lF "$@";
90}
91