shell script respond to keypress

后端 未结 5 1596
逝去的感伤
逝去的感伤 2020-12-06 00:25

I have a shell script that essentially says something like

while true; do
    read -r input
    if [\"$input\" = \"a\"]; then 
        echo \"hello world\"          


        
5条回答
  •  一个人的身影
    2020-12-06 00:51

    read -rsn1
    

    Expect only one letter (and don't wait for submitting) and be silent (don't write that letter back).

提交回复
热议问题