I'm running Puppet, and I need to run one of the defined exec
commands only if a line does not exist in the output from a different command. I can set up a contingency with a unless
clause (which will run the command unless another command returns exit code 0
) or with a onlyif
clause (which will run a command only if another command returns exit code 0
).
Is there a standard Linux command which will verify a particular substring exists in the input, and return an exit code otherwise?