[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash: problem with [sets]



On Mon, Jun 23, 2003 at 03:37:43PM -0500, matt zagrabelny wrote:
> On Mon, 2003-06-23 at 13:57, David selby wrote:
> > If this is the case, how can I test a string ?
> 
> for your enjoyment:
> 
> #!/bin/bash
>  
> if echo $fourdig | grep ^[0-9]*$ > /dev/null 2>&1; then

That *really* needs some quoting ...

  if echo "$fourdig" | grep '^[0-9]*$' > /dev/null 2>&1; then

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: