2007-01-05 00:40:50 +01:00
|
|
|
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.4 2007/01/04 23:40:50 tg Exp $
|
|
|
|
#-
|
|
|
|
# Add user-defined additions at the end, to prevent abortion on failure.
|
2006-07-23 20:44:22 +02:00
|
|
|
|
2006-08-28 03:34:47 +02:00
|
|
|
: ${EDITOR:=/bin/ed} ${HOSTNAME:=$(hostname -s 2>/dev/null || hostname)}
|
2006-07-23 20:44:22 +02:00
|
|
|
PS1='$(((rv=$?)) && print $rv\|)${USER:=$(id -un)}@${HOSTNAME:=nil}:$(
|
|
|
|
local pfx=~ wd=${PWD:-$(pwd)}
|
|
|
|
[[ ${wd#$pfx} = $wd || $pfx = ?(/) ]] || wd=\~${wd#$pfx}
|
|
|
|
pfx=; let n="( (n = ${COLUMNS:-80} / 3) < 7 ? 7 : n)"
|
|
|
|
while (( (${#pfx} + ${#wd}) > n )); do
|
|
|
|
if [[ $wd = */* ]]; then
|
|
|
|
pfx=.../
|
|
|
|
wd="${wd#*/}"
|
|
|
|
else
|
|
|
|
pfx=...
|
|
|
|
wd="${wd#?????}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
print -r -- "$pfx$wd")'" $(if (( $(id -u) )); then
|
2007-01-05 00:40:50 +01:00
|
|
|
print \$; else print \#; fi) " MKSH=$(whence -p mksh)
|
|
|
|
export EDITOR HOSTNAME MKSH PS1 USER
|
2006-07-23 20:44:22 +02:00
|
|
|
|
|
|
|
alias l='/bin/ls -F'
|
|
|
|
alias la='l -a'
|
|
|
|
alias ll='l -l'
|
|
|
|
alias lo='la -lo'
|
2006-08-28 03:34:47 +02:00
|
|
|
[ -x /usr/bin/hd ] || eval alias hd=\''hexdump -e '\''\'\'''\''"%08.8_ax' \
|
|
|
|
' " 8/1 "%02X " " - " 8/1 "%02X "'\''\'\'''\'' -e '\''\'\'''\'\" \
|
|
|
|
' |" "%_p"'\''\'\'''\'' -e '\''\'\'''\''"|\n"'\''\'\'''\'' '\'
|
2006-07-23 20:44:22 +02:00
|
|
|
|
2006-08-14 22:32:44 +02:00
|
|
|
# strip comments (and leading/trailing whitespace if IFS is set) from
|
|
|
|
# any file(s) given as argument, or stdin if none, and spew to stdout
|
|
|
|
function Lstripcom
|
2006-07-23 20:44:22 +02:00
|
|
|
{
|
|
|
|
cat "$@" | while read _line; do
|
2006-08-14 22:32:44 +02:00
|
|
|
set -o noglob
|
2006-07-23 20:44:22 +02:00
|
|
|
_line=${_line%%#*}
|
|
|
|
[[ -n $_line ]] && print -r -- $_line
|
|
|
|
done
|
|
|
|
}
|