|
egrep syntax question
I have a (seemingly) simple question for you guys
I need my script to allow users to enter numbers with either 2 decimal points or with no decimal points.
here's the code I have right now for testing, but I can't for the life of me figure out whats wrong!
(it's been broken up into 2 different grep statements)
decimal=10.500
echo $decimal | egrep -q '[0-9+]' && echo success || echo failure
echo $decimal | egrep -q '[0-9+]\.[0-9][0-9]' && echo success || echo failure
any insight would be greatly appreciated as this has been the cause of much frustration for me!
|