I am trying to understand what dose the -o mean in the following bash if script.
looking at the results I can guess what it does but I do really need to get the concept of it.
i=1 for day in Mon Tue Wed Thu Fri Sat Sun do echo -n "Day $((i++)) : $day" if [ $i -eq 7 -o $i -eq 8 ]; then echo " (WEEKEND)" continue; fi echo " (weekday)" done The results are as following:
$ ./for7.sh Day 1 : Mon (weekday) Day 2 : Tue (weekday) Day 3 : Wed (weekday) Day 4 : Thu (weekday) Day 5 : Fri (weekday) Day 6 : Sat (WEEKEND) Day 7 : Sun (WEEKEND)
||(OR). e.g.$i -eq 7OR$i -eq 8. It can also be used to test whether an option set bysetis set... (that's a lot of sets). That is why you are better off using[ "$i" -eq 7 ] || [ "$i" -eq 8 ](note: always quote your variables with[...])[is a builtin command. See:help test.