shell script respond to keypress

后端 未结 5 1586
逝去的感伤
逝去的感伤 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:50

    so the final working snippet is the following:

    #!/bin/bash
    
    while true; do
    read -rsn1 input
    if [ "$input" = "a" ]; then
        echo "hello world"
    fi
    done
    

提交回复
热议问题