Capturing arrow keys in shell scripts

Discussion in 'Mac Programming' started by matt90, Sep 16, 2008.

  1. matt90 macrumors member

    Feb 18, 2008
    Los Alamos, New Mexico (Atomic City)
    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?

Share This Page