Good day all
Purpose: checking if a string exists in a file and running actions accordingly
if [ -z 'sudo cat /etc/sudoers | grep "$USER ALL=(ALL) NOPASSWD:ALL"' ]; echo "no output, cont." || echo "line exists, skipping"
The output always presents "line exists, skipping" in bot cases where the line exists and does not.
Adding the output into a variable e.g. x, substituting the line in the if statement with the variable produces the correct output,
How may I 'skip' the variable route and run the command directly?