I’m using the following conditional in a bash script:
if `grep -q "${ACTION_LABEL} Action" "${OVERRIDE_ACTIONS}"`; then
....
fi
It basically works. Except if any part of the path in ${OVERRIDE_ACTIONS} contains a space, then the grep fails. How can I get this to work with paths containing spaces>
Remove the backticks:
Why?
grepwill return a value of0if it succeeded in finding occurences for your pattern, or1if it failed. The body of theifstatement will be executed, if the condition evaluates to0.