regex v podmienke

Sekcia: Konfigurácia 26.11.2009 | 00:31
xF0RC3   Návštevník
cau opat...

potrebujem do podmienky IF umiestnit regularny vyraz...

If you are familiar with Regular Expressions, you can use this conditions to perform a regex match.

if [[ "$email" =~ "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b" ]]; then
echo "\$email contains a valid e-mail address."
fi

http://www.linuxtutorialblog.com/post/tutorial-conditions-in-bash-scripting-if-statements
____________________
v mojom pripade

if [[ "$velkost" =~ "\b[0-9]\b" ]]; then

3: line 71: conditional binary operator expected
3: line 71: syntax error near unexpected token `=~'
3: line 71: ` if [[ "$velkost" =~ "\b[0-9]\b" ]]; then'

FreeBSD/Bash Shell
_____________________
mate dake napady?





    • Re: regex v podmienke 26.11.2009 | 00:32
      xF0RC3   Návštevník
      kurna zla sekcia. sry
      • Re: regex v podmienke 26.11.2009 | 12:35
        xF0RC3   Návštevník
        vyriesene.

        staci tam dat == namiesto =~