Re: [Bashburn-info] Pressing any key in menu balks
Brought to you by:
bashburn
|
From: Steven W. O. <st...@sy...> - 2008-08-30 20:41:38
|
On Saturday, Aug 30th 2008 at 12:48 -0000, quoth Nick Warne:
=>On Sat, 30 Aug 2008 17:45:31 +0100
=>Nick Warne <ni...@uk...> wrote:
=>
=>> On Sat, 30 Aug 2008 12:03:10 -0400 (EDT)
=>> "Steven W. Orr" <st...@sy...> wrote:
=>>
=>> > if (( selection == 0 )) && [[ "$chselection" != 0 ]]
=>> > then
=>> > echo 'Error: Input must be numeric'
=>> > elif (( selection >= 0 && selection < size ))
=>> > then
=>> > eval ${action[selection]} # Do it baby.
=>> > else
=>> > # Bitch if the input was out of bounds.
=>> > echo 'Error: Input must be in range'
=>> > nogood=1
=>> > fi
=>>
=>> Very good. Many ways to skin a cat in GNU/Linux world.
=>>
=>> Works great.
=>>
=>> Nick
=>
=>Famous last words. If you type a none digit/alpha character (i.e. # ~
=>@ etc. ) oops.
=>
=>The regex line I done just stripped anything that wasn't a digit.
Ok, this time for sure.
You can't remove the offending characters from selection because it's
already types as integer. So the variable never had a value that contained
offedning characters. You were going in the right direction, but you have
to assign to selection the result of stripping out the bad characters, and
THEN compare selection to see if it's not equal to chselection.
I think this time we got it.
The sequence that showed the problem before was to enter some numbers that
were interspaced with bad stuff. All that would be left were the numbers
and then it tested to see if it was in range.
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
|