No wonder it's glitching - why use 0.1s timeout? – suspectus
suspectus asked a good question. user3047492, just drop the -t 0.1
(unless there are further requirements about which you kept quiet).
Question
I need to control 2 variables using k and j keys. Now, I have this solution
read -s -n 1 -t 0.1 keys
if [[ "$keys" == k ]]; then
wpm=$(($wpm+10))
if [[ "$wpm" -gt 1000 ]]; then
wpm=$(($wpm-10))
fi
fi
if [[ "$keys" == j ]]; then
wpm=$(($wpm-10))
if [[ "$wpm" -lt 100 ]]; then
wpm=$(($wpm+10))
fi
fi
It is not elegant and it is glitching. I know there are bind command, but I need to give this script to users and Im not sure they would bother with source(which solve "Warning: line editing not enabled" command.
Is there any other ways to do it?
Solution
No wonder it's glitching - why use 0.1s timeout? – suspectus
suspectus asked a good question. user3047492, just drop the -t 0.1
(unless there are further requirements about which you kept quiet).