verify:
@command -v gpg 2>/dev/null || { echo "Cound not find gpg. Aborting."; exit 1; }
I saw the following command in a Makefile. I understand that it does the following:
verify
is called beforebuild
in Makfile@command
is used to not echo the command being run and to not echo the output of the command which will be invoked-v gpg 2>/dev/null
will check the version and if gpg is not found it will redirect the error output(sterr) to null(nowhere)|| { echo "Cound not find gpg. Aborting."; exit 1; }
will echo a message and exit the current script with error 1 if the previous command creates an error (returns false which is why || is there)
What I don't understand is -v gpg
. When checking the version the -v
normally comes after the command. Is there a reason for doing this?