I have a loop after setting stty -icanon time 0 min 0 to prevent read from blocking.
It works okay except it cant read the enter/return key.
Is there any way to read the enter key in this mode, or any other way my code could be written ?
Relevant Code
tput smcup
Draw
if [ -t 0 ]; then stty -icanon time 0 min 0; fi
count=0
keypress=''
while [ "$keypress" != "q" ]; do
sleep 0.1
(( count = count + 1 ))
rows=$(tput lines)
columns=$(tput cols)
Draw
read keypress
name=$name$keypress
echo $name
if [[ $oldcolumns != $columns || $oldrows != $rows ]];then
Draw
oldcolumns=$columns
oldrows=$rows
elif [[ $count -eq 1 ]]; then
# Draw
count=0
fi
done
if [ -t 0 ]; then stty sane; fi
tput rmcup
#rm tail.tmp
echo "Thanks for using this script."
exit 0