Re: [Bashburn-info] Pressing any key in menu balks
Brought to you by:
bashburn
|
From: Nick W. <ni...@uk...> - 2008-08-30 19:11:50
|
On Sat, 30 Aug 2008 17:57:41 +0100
Nick Warne <ni...@uk...> wrote:
> On Sat, 30 Aug 2008 17:48:17 +0100
> Nick Warne <ni...@uk...> 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.
>
> Thinking, perhaps what I done _is_ the right thing i.e. sanitise the
> input before deliberating what needs to be done later in the code.
>
> I guess it could be more elegant though...
>
> Nick
OK, I think I found it. I liked the warning about none-digit entered -
so sanitise the cloned $VAR! Seems to work good now.
Nick
--
Free Software Foundation Associate Member 5508
|