xxxxxxxxxx
if which wget >/dev/null ; then
echo "Downloading via wget."
wget --option argument
elif which curl >/dev/null ; then
echo "Downloading via curl."
curl --option argument
else
echo "Cannot download, neither wget nor curl is available."
fi
xxxxxxxxxx
wget http://download/url/file 2>/dev/null || curl -O http://download/url/file
xxxxxxxxxx
pax> which ls ; echo $?
/bin/ls
0
pax> which no_such_executable ; echo $?
1