Bash function to check if it’s friday

Ever wondered if today’s Friday? Yeah me too, every day.

Keep yourself updated with this simple function.

 

1) Open your profile settings file
nano ~/.bashrc

2) Enter the following function in the bottom

yay() {
    day=$(date +%u)
    if [ "$day" == "5" ];
    then
        echo "YAY, IT'S FRIDAY!!!"
    else
        echo "Not to bring you down, but it's not friday yet :("
    fi
}

3) Reload your config file
. ~/.bashrc

4) Try it out! Just type yay in your terminal window whenever you wonder if it’s Friday or not.

Was this post helpful?
Yes
No
Powered by Devhats

Leave a Reply

Your email address will not be published. Required fields are marked *