Last active
January 10, 2022 00:34
-
-
Save bmcculley/ec2323d8132290dcb7b8 to your computer and use it in GitHub Desktop.
A handy shell script to use as a starting point if you need to setup something that only fires on x days of the week.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################################### | |
# A handy starting point if you need to setup something that only fires on x # | |
# days of the week. # | |
############################################################################### | |
DAYNUM=$(date +"%u") | |
if [ $DAYNUM -eq 1 ]; then | |
echo "It's Monday" | |
elif [ $DAYNUM -eq 2 ]; then | |
echo "It's Tuesday" | |
elif [ $DAYNUM -eq 3 ]; then | |
echo "It's Wednesday" | |
elif [ $DAYNUM -eq 4 ]; then | |
echo "It's Thursday" | |
elif [ $DAYNUM -eq 5 ]; then | |
echo "It's Friday" | |
elif [ $DAYNUM -eq 6 ]; then | |
echo "It's Saturday" | |
elif [ $DAYNUM -eq 7 ]; then | |
echo "It's Sunday" | |
else | |
echo "I have no idea" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################################### | |
# A handy starting point if you need to setup something that only fires on x # | |
# days of the week. # | |
############################################################################### | |
DAYNUM=$(date +"%u") | |
if [ $DAYNUM -eq 1 ]; then | |
echo "It's Monday" | |
elif [ $DAYNUM -eq 2 ]; then | |
echo "It's Tuesday" | |
elif [ $DAYNUM -eq 3 ]; then | |
echo "It's Wednesday" | |
elif [ $DAYNUM -eq 4 ]; then | |
echo "It's Thursday" | |
elif [ $DAYNUM -eq 5 ]; then | |
echo "It's Friday" | |
elif [ $DAYNUM -eq 6 ] || [ $DAYNUM -eq 7 ]; then | |
echo "It's the weekend!" | |
else | |
echo "I have no idea" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment