Problem
I may or may not have the executable thing in my $PATH.
How can I neatly check this in a ZSH script?
Existing Attempt
I just run the command, sending the output and errors or noman's land, then check the result code.
thing > /dev/null 2>&1
thing_installed=$?
if [ $thing_installed -eq 0 ]; then
echo 'Thing Installed!'
fi
I feel like this could be done more neatly (one liner?).
-x file True if file exists and is executable. True indicates only that the execute flag is on. If file is a directory, true indicates that file can be searched.-4!-4when I accepted it... Glad you got some amusement out of it though ;)