From 00085f1df9b9da86d01105627f7c42a0669b1e0b Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Thu, 11 Mar 2010 00:28:32 +0100 Subject: [PATCH] zshrc: Fixed `minimal-shell' function Well, it was actually completely broken. Because I fed an absolute path name into `check_com()' without testing it - instead of using the obvious test. This also fixes an annoyance: If infocmp returns an octal code such as this: backspace='\177' That screwed up our special-string resolution, because mksh's `print' builtin doesn't like \177 style octals. It *requires* them to look like this: \0177 (leading zero). We now just translate these strings like this: \\[1-7][0-7]* => \\0[1-7][0-7]* That should be fairly safe. - And this time, mika and me actually tested the code before committing it. :-) --- etc/minimal-shellrc | 3 ++- etc/zsh/zshrc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/minimal-shellrc b/etc/minimal-shellrc index 68dccdf..dec53b5 100644 --- a/etc/minimal-shellrc +++ b/etc/minimal-shellrc @@ -43,7 +43,8 @@ if [[ -x $(which infocmp) ]] && [[ -x $(which sed) ]] ; then while read -r line ; do key="${line%=*}" [[ "${key}" != k* ]] && continue - seq="$(print "${line#*=}")" + seq="$(printf '%s' "${line#*=}" | sed -e 's,\\\([1-7][0-7]*\),\\0\1,g')" + seq="$(print "${seq}")" case "$key" in key_left) bind "${seq}"='backward-char' ;; key_right) bind "${seq}"='forward-char' ;; diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 4178304..345bbd5 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -2969,7 +2969,7 @@ minimal-shell() { emulate -L zsh local shell="/bin/mksh" - if ! check_com -c ${shell}; then + if [[ ! -x ${shell} ]]; then printf '`%s'\'' not available, giving up.\n' ${shell} >&2 return 1 fi -- 2.1.4