1 # Set the xterm window title to the current working directory
2 # plus either the currently executing command line or “<mksh>”
4 PS1='#'; (( USER_ID )) && PS1='$'; PS1=$'\001\r''${|
7 (( e )) && REPLY+="$e|"
8 REPLY+=${USER}@${HOSTNAME%%.*}:
10 \\builtin typeset d=${PWD:-?}/ p=~; [[ $p = ?(*/) ]] || d=${d/#$p\//\~/}
11 d=${d%/}; \\builtin typeset m=${%d} n p=...; (( m > 0 )) || m=${#d}
12 (( m > (n = (COLUMNS/3 < 7 ? 7 : COLUMNS/3)) )) && d=${d:(-n)} || p=
15 print >/dev/tty -nr -- $'\''\001\e]2;'\''"[$PWD] <mksh>"$'\''\a\001'\''
19 bind -m '^M=^U^Y^Y^X^X^[ IFS= read -rN-1 _cmd <<\EOF^V^J^E^V^JEOF^V^Jprint >/dev/tty -nr -- $'\''\e]2;'\''"[$PWD] ${_cmd%?}"$'\''\a'\''^[^E^J'