I have a large shell script that install a bunch of stuff. 9/10 times, it will work fine, however, it sometimes fails due to internet connectivity issues.
currently I have
apt-get install -y apache2 || { exit 1; }
and it works.
and I know that !!
resembles the last command.
However, this does not work
apt-get install -y apache2 || { echo "!! Failed"; exit 1; }
I would expect the output, if failed, be:
apt-get install -y apache2 Failed
lastly, is there a way not to have the || { echo "!! Failed"; exit 1; }
after every command.