Bash code for detecting enter key does not work in interactive shell
I scrounged this together from other answer on this site for code that detects the enter key:
while true
do
read -r -s -n 1 key
if [[ "$key" == $'\n' ]]
then
echo "Breaking loop..."
break
fi
done
It doesn't work in the command line though. Why is that?