I'm trying to store the output the which
command. Here's what I've tried:
OUT=$(which gsutil)
echo "$(OUT)"
But it doesn't work and prints an empty line.
I'm trying to store the output the which
command. Here's what I've tried:
OUT=$(which gsutil)
echo "$(OUT)"
But it doesn't work and prints an empty line.
The which
command is a broken heritage from the C-Shell and is better left alone in Bourne-like shells.
Instead use command -v
:
OUT=$(command -v gsutil)
echo "${OUT}"