fix for $HOME with trailing slash (do not expand then either… we could just
strip it, but that might have other problems, better is to use realpath(2), e.g. via readlink(1), for normalisation, or have the sysop fix it) XXX make realpath a builtin?
This commit is contained in:
parent
8cf7c94908
commit
4e4ede2442
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.35 2008/05/16 22:19:11 tg Exp $
|
||||
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.36 2008/05/16 22:22:11 tg Exp $
|
||||
#-
|
||||
# ~/.mkshrc: mksh initialisation file for interactive shells
|
||||
|
||||
@ -13,7 +13,7 @@ function precmd {
|
||||
PS1='$(precmd)${USER:=$(ulimit -c 0;id -un 2>&- || print \?)}@${HOSTNAME%%.*}:$(
|
||||
typeset pfx=~ wd=${PWD:-?}
|
||||
typeset -i n=${COLUMNS:-80}/3; (( n = n < 7 ? 7 : n ))
|
||||
[[ $pfx = ?(/) ]] || wd=${wd/#$pfx/~}
|
||||
[[ $pfx = ?(*/) ]] || wd=${wd/#$pfx/~}
|
||||
pfx=; while (( (${#pfx} + ${#wd}) > n )); do
|
||||
if [[ $wd = */* ]]; then
|
||||
pfx=.../
|
||||
@ -46,7 +46,7 @@ DIRSTACKBASE=$(readlink -nf ~/. 2>&- || print -nr -- "$HOME")
|
||||
set -A DIRSTACK
|
||||
function chpwd {
|
||||
DIRSTACK[0]=$(readlink -nf . 2>&- || print -r -- "$PWD")
|
||||
[[ $DIRSTACKBASE = ?(/) ]] || \
|
||||
[[ $DIRSTACKBASE = ?(*/) ]] || \
|
||||
DIRSTACK[0]=${DIRSTACK[0]/#$DIRSTACKBASE/~}
|
||||
:
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user