Question

Usually, I use square brackets in the if statement:

if [ "$name" = 'Bob' ]; then ...

But, when I check if grep succeeded I don't use the square brackets:

if grep -q "$text" $file ; then ...

When are the square brackets necessary in the if statement?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top