PDA

View Full Version : Capturing arrow keys in shell scripts




matt90
Sep 16, 2008, 09:28 PM
I'm a novice UNIX programmer (shell scripter?) and I recently wanted to make a program that uses the arrow keys. I know that the arrow keys generate "\033[A," "\033[B," etc., but when I try

read -n 1 input
if [ "$input" = "\033[A" ]
.....

the test always comes out negative. Is it a problem with read or test or what? What do I do?