Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Enterキーを押さずに、矢印キー、数字、文字、句読点など、任意のキーが押されたときにbashで読み取りたい。
これは私が思いついた最も近いもので、エスケープされたキーが押されると、次の入力にスピルオーバーします。また、エスケープされたキーは読み取りますが、エコーしません。
#!/bin/bash read -r -n 1 -d $'\n' -p 'input> ' line echo -en "\n" echo "$line"