Bash 在readline中使用“选择”菜单时忽略箭头键

Bash 在readline中使用“选择”菜单时忽略箭头键,bash,select,options,backspace,arrow-keys,Bash,Select,Options,Backspace,Arrow Keys,我已经编写了一个bash脚本,看起来像这样,它基本上处理基于选择的用户操作 PS3='Please enter current status of the completion: ' boolean_status=("completed" "not-yet") select opt in "${boolean_status[@]}" do if [ "$REPLY" -ge 1 -a "$REPLY" -le 2 ]; then n=$

我已经编写了一个bash脚本,看起来像这样,它基本上处理基于选择的用户操作

PS3='Please enter current status of the completion: '
    boolean_status=("completed" "not-yet")
    select opt in "${boolean_status[@]}"
    do
       if [ "$REPLY" -ge 1 -a "$REPLY" -le 2 ]; then   
        n=$opt
        break;
       fi
    done
但是我面临着这个代码片段的问题。这个代码的输入接受
退格为^H
向上为[[a^
等。我希望我的用户可以自由使用上下箭头,而不会弹出这些符号。有没有办法解决这个问题


就像在
read
命令中一样,我们有一个
-e
选项,它忽略了所有这些字符,select中的等价物是什么???

似乎您需要一个使用readline的select替换项。@DanD.好的,但是我如何在这里使用readline???将那里的
read-p'.\opt
替换为
read-e-p'.\opt
来使用readline@KNDheeraj:答案对你有帮助吗?@Inian事实上我试过cyrus的解决方案,效果很好,所以没有测试你的解决方案!!