Bash - Suppressing output to STDOUT
Turns out the xpath=( xcode-select --print-path )
line in the if
statement of the original function was the problem. Additionally, once I got the error message suppressed, I noticed there was an unnecessary stdout message, so I decided to suppress that as well.
I was able to suppress the stderror and stdout messages by changing the function to the following:
function check_clt() {
if type xcode-select >/dev/null 2>&1 >&- && xcode-select -p >/dev/null 2>&1 && test -d $(xcode-select -p) >/dev/null 2>&1 && test -x $(xcode-select -p) >/dev/null 2>&1; then
echo ""
echo "The required Xcode command-line-tools are already installed! Moving on!"
sleep 3
else
instructions
sleep 45
xcode-select --install
fi
}