You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
lang-bash
test -x $(which ls)returns 0, as doestest -x $(which sudo), even thoughlsis installed and runnable andsudois not even installed within the docker container I'm running in.test -x "$(which <command>)"lsis aliased? I dont think it would work if the command has parameter.$ test -x $(which absent_cmd)returnstest: too many arguments, whiletest -x "$(which absent_cmd)"is properly parsed and results in exit code 1.test: too many argumentssuggests thatwhich absent_cmdreturns a multi-word error message. An executable file having the same name as the message could exist. 😁 Usingwhichthis way is just a bad idea.