we must quote a tilde in substitutions now
This commit is contained in:
parent
8d22d9226f
commit
ceb98d7558
12
dot.mkshrc
12
dot.mkshrc
@ -1,5 +1,5 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.102 2015/10/09 21:36:54 tg Exp $
|
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.103 2015/12/12 18:47:40 tg Exp $
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013, 2014, 2015
|
# 2011, 2012, 2013, 2014, 2015
|
||||||
@ -40,7 +40,7 @@ PS4='[$EPOCHREALTIME] '; PS1=$'\001\r''${|
|
|||||||
(( e )) && REPLY+="$e|"
|
(( e )) && REPLY+="$e|"
|
||||||
REPLY+=${USER}@${HOSTNAME%%.*}:
|
REPLY+=${USER}@${HOSTNAME%%.*}:
|
||||||
|
|
||||||
\typeset d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || d=${d/#$p/~}
|
\typeset d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || d=${d/#$p/\~}
|
||||||
\typeset m=${%d} n p=...; (( m > 0 )) || m=${#d}
|
\typeset m=${%d} n p=...; (( m > 0 )) || m=${#d}
|
||||||
(( m > (n = (COLUMNS/3 < 7 ? 7 : COLUMNS/3)) )) && d=${d:(-n)} || p=
|
(( m > (n = (COLUMNS/3 < 7 ? 7 : COLUMNS/3)) )) && d=${d:(-n)} || p=
|
||||||
REPLY+=$p$d
|
REPLY+=$p$d
|
||||||
@ -109,7 +109,7 @@ function chpwd {
|
|||||||
DIRSTACK[0]=$(\builtin realpath . 2>/dev/null || \
|
DIRSTACK[0]=$(\builtin realpath . 2>/dev/null || \
|
||||||
\builtin print -r -- "$PWD")
|
\builtin print -r -- "$PWD")
|
||||||
[[ $DIRSTACKBASE = ?(*/) ]] || \
|
[[ $DIRSTACKBASE = ?(*/) ]] || \
|
||||||
DIRSTACK[0]=${DIRSTACK[0]/#$DIRSTACKBASE/~}
|
DIRSTACK[0]=${DIRSTACK[0]/#$DIRSTACKBASE/\~}
|
||||||
\:
|
\:
|
||||||
}
|
}
|
||||||
\chpwd .
|
\chpwd .
|
||||||
@ -118,7 +118,7 @@ cd() {
|
|||||||
\chpwd "$@"
|
\chpwd "$@"
|
||||||
}
|
}
|
||||||
function cd_csh {
|
function cd_csh {
|
||||||
\typeset d t=${1/#~/$DIRSTACKBASE}
|
\typeset d t=${1/#\~/$DIRSTACKBASE}
|
||||||
|
|
||||||
if ! d=$(\builtin cd "$t" 2>&1); then
|
if ! d=$(\builtin cd "$t" 2>&1); then
|
||||||
\builtin print -u2 "${1}: ${d##*cd: $t: }."
|
\builtin print -u2 "${1}: ${d##*cd: $t: }."
|
||||||
@ -148,7 +148,7 @@ function dirs {
|
|||||||
fv=0
|
fv=0
|
||||||
while (( fv < ${#DIRSTACK[*]} )); do
|
while (( fv < ${#DIRSTACK[*]} )); do
|
||||||
d=${DIRSTACK[fv]}
|
d=${DIRSTACK[fv]}
|
||||||
(( fl )) && d=${d/#~/$DIRSTACKBASE}
|
(( fl )) && d=${d/#\~/$DIRSTACKBASE}
|
||||||
\builtin print -r -- "$fv $d"
|
\builtin print -r -- "$fv $d"
|
||||||
\builtin let fv++
|
\builtin let fv++
|
||||||
done
|
done
|
||||||
@ -156,7 +156,7 @@ function dirs {
|
|||||||
fv=0
|
fv=0
|
||||||
while (( fv < ${#DIRSTACK[*]} )); do
|
while (( fv < ${#DIRSTACK[*]} )); do
|
||||||
d=${DIRSTACK[fv]}
|
d=${DIRSTACK[fv]}
|
||||||
(( fl )) && d=${d/#~/$DIRSTACKBASE}
|
(( fl )) && d=${d/#\~/$DIRSTACKBASE}
|
||||||
(( dwidth = (${%d} > 0 ? ${%d} : ${#d}) ))
|
(( dwidth = (${%d} > 0 ? ${%d} : ${#d}) ))
|
||||||
if (( fn && (cpos += dwidth + 1) >= 79 && \
|
if (( fn && (cpos += dwidth + 1) >= 79 && \
|
||||||
dwidth < 80 )); then
|
dwidth < 80 )); then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user