![]() If it is, then it matches pattern number 1 and will echo “today is a weekday.” If that does not match, it checks to see if the date is Sat or Sun. Then our case statement will check whether the result is Mon, Tue, Wed, Thu, or Fri. What is happening in the script? The date +"%a" command is getting information about what day of the week it is. However, the case statement is still comparing strings in order to determine which clause will be matched. In this case we do not need to use any conditional operators. This script will let us know whether today is a weekday or weekend.Īnd here is what happens when we execute the script: Let’s look at a simple example which has statements tied to multiple patterns.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |