xref: /haiku/data/etc/profile (revision 4d978eea2f9530892046f3344341ed85c9e0b1cf)
1#
2# Administrative startup for /bin/sh
3# Place user customizations in /.profile
4#
5
6echo -e "\nWelcome to the Haiku shell.\n"
7
8export USER=`id -un`
9export GROUP=`id -gn`
10
11if [ -z $BE_HOST_CPU ]; then
12	. /boot/system/boot/SetupEnvironment
13fi
14
15export PS1="\w> "
16export HISTFILESIZE=50
17export HISTCONTROL=ignoredups
18
19alias ls="ls --color"
20alias ll="ls -lA"
21alias la="ls -A"
22alias m="more"
23
24shopt -s checkwinsize
25
26#
27# and now we include a few useful things...
28#
29
30#
31# An almost-ksh compatible `whence' command.  This is as hairy as it is
32# because of the desire to exactly mimic ksh.
33#
34# This depends somewhat on knowing the format of the output of the bash
35# `builtin type' command.
36#
37# Chet Ramey
38# chet@ins.CWRU.Edu
39#
40whence()
41{
42	local vflag= path=
43
44	if [ "$#" = "0" ] ; then
45		echo "whence: argument expected"
46		return 1
47	fi
48	case "$1" in
49		-v) vflag=1
50		    shift 1
51		    ;;
52		-*) echo "whence: bad option: $1"
53		    return 1
54		    ;;
55		 *) ;;
56	esac
57
58	if [ "$#" = "0" ] ; then
59		echo "whence: bad argument count"
60		return 1
61	fi
62
63	returnValue=0
64
65	for cmd
66	do
67		if [ "$vflag" ]	 ; then
68			echo $(builtin type $cmd | sed 1q)
69		else
70			path=$(builtin type -path $cmd)
71			if [ "$path" ] ; then
72				echo $path
73			else
74				case "$cmd" in
75					*/*) if [ -x "$cmd" ]; then
76							echo "$cmd"
77						else
78							returnValue=1
79					    fi
80					    ;;
81					 *) case "$(builtin type -type $cmd)" in
82						"") returnValue=1
83							;;
84						 *) echo "$cmd"
85						    ;;
86					    esac
87					    ;;
88				esac
89			fi
90		fi
91	done
92	return $returnValue
93}
94
95alias which='whence'
96
97function dir {
98	ls -lF "$@";
99}
100
101# enable programmable completion
102if [ -f /etc/bash_completion ]; then
103    . /etc/bash_completion
104fi
105
106