0

I try to use regexes in my bash script. I don't understand why the result of this simple example is "ko":

foo='bar'; if [[ $foo =~ '^[a-z]+$' ]] ; then echo "ok"; else echo "ko"; fi

1 Answer 1

2

Remove both ':

foo='bar'; if [[ $foo =~ ^[a-z]+$ ]] ; then echo "ok"; else echo "ko"; fi
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.