lundi 6 novembre 2017

Bash conditional expression: `-o` . What dose it mean?

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)

Aucun commentaire:

Enregistrer un commentaire