ksh キーバインディングトラップ

ksh キーバインディングトラップ

このコード例に従おうとしています。

http://www.kornshell.com/examples/keybind

# Example from page 98
typeset -A Keytable
trap 'eval "${Keytable[${.sh.edchar}]}"' KEYBD
function keybind # key [action]
{
    typeset key=$(print -f "%q" "$2")
    case $# in
    2)      Keytable[$1]=' .sh.edchar=${.sh.edmode}'"$key"
            ;;
    1)      unset Keytable[$1]
            ;;
    *)      print -u2 "Usage: $0 key [action]"
            return 2 # usage errors return 2 by default
            ;;
    esac
}

これ:https://cs.nyu.edu/courses/fall01/G22.2245-001/syll/lect7.pdf

Ctrl + Cを押すとターミナルラインが消去され、Ctrl + LIを押すと^ Lが表示されます。

Ctrl + LをClearコマンドにバインドしたいです。

このコマンドをキャッチして端末を消去するには、上記のKEYBD機能をどのように設定する必要がありますか?

ベストアンサー1

おすすめ記事