Hi all,
I need to know how to test a pressed key is arrowup or arrowdown and etc..
I found that the "echo" won't print anything if i enter the arrowup in the below code:
read
echo "you pressed $REPLY"
Then i find a way to achieve my goal.
1 #! /bin/bash
2
3 ARROWUP='\[A'
4 read
5 echo $REPLY | grep -q $UP
6 if [ $? -eq 0 ];then
7 echo "you pressed arrowup"
8 fi
problem is where can i find "ARROWUP" is shown as \[A because in my terminal the arrowup key is shown as [[A and i'm afraid i won't remember that someday.Any command to show that?