Conditional blocks of code in linux bash
- by Arek
Nearly everybody knows very useful && and || operators, for example:
rm myf && echo "File is removed successfully" || echo "File is not removed"
I've got a question: how to put a block of commands after && or || operators without using the function?
For example I want to do:
rm myf && \
echo "File is removed successfully" \
echo "another command executed when rm was successful" || \
echo "File is not removed" \
echo "another command executed when rm was NOT successful"
What is the proper syntax of that script?