Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/bin/bash # http://www.codelibary.com/Bash/Arrow-key-detect.html arrowup='\[A' SUCCESS=0 OTHER=65 echo -n "Press a key... " # May need to also press ENTER if a key not listed above pressed. read -n3 key # Read 3 characters. echo -n "$key" | grep "$arrowup" #Check if character code detected. if [ "$?" -eq $SUCCESS ] then echo "Up-arrow key pressed." exit $SUCCESS fi exit $OTHER
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Translating Bash to Perl
by almut (Canon) on Sep 30, 2009 at 20:54 UTC | |
|
Re: Translating Terminal Input Code from Bash to Perl
by jakobi (Pilgrim) on Sep 30, 2009 at 20:50 UTC | |
by Anonymous Monk on Sep 30, 2009 at 20:53 UTC | |
by jakobi (Pilgrim) on Sep 30, 2009 at 20:57 UTC | |
by Anonymous Monk on Sep 30, 2009 at 20:58 UTC | |
by jakobi (Pilgrim) on Sep 30, 2009 at 22:18 UTC | |
|
Re: Translating Bash to Perl
by ikegami (Patriarch) on Sep 30, 2009 at 20:32 UTC | |
|
Re: Translating Bash to Perl
by bichonfrise74 (Vicar) on Sep 30, 2009 at 21:41 UTC | |
|
Re: Translating Bash to Perl
by Anonymous Monk on Sep 30, 2009 at 20:47 UTC |