3

I am using [[ $each_word == [* ]] right now. It doesn't cause an error, but I am not sure if it is safe. Also does this cover all cases for words that begin with '['

1 Answer 1

4

It appears that the parser treats [ literally instead of as the start of a bracket expression because the bracket expression ends prematurely. To be safe, I would quote it to make explicit that you want a literal [:

[[ $each_word == "["* ]]
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.