So, here is simple example that does simple “and” (-a) “or” (-o) conditioning for the “if” loop in bash shell scripting. The following script prints “DONE” if the condition is satisfied.
# Example for using and (-a) in bash.
if [ $a1 -eq 3 -a $b1 -eq 4 ]; then
# Example for using or (-o) in bash.
if [ $a1 -eq 3 -o $b1 -eq 4 ]; then
If you like this article, then please consider sharing it. Sharing really inspires us to do things much better!!