Created
November 10, 2016 15:26
-
-
Save KrashLeviathan/238241f7887135f59ddea905f99cf528 to your computer and use it in GitHub Desktop.
Command Line Verse of the Day
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
#!/usr/bin/env bash | |
# Asynchronously gets the Verse of the Day from OurManna.com and prints it to the terminal | |
# Must have httpie installed for it to work! (Visit https://httpie.org/) | |
function printVotd { | |
# Uses the REST API to get the verse of the day, discarding any errors | |
votd=`http --print=b http://www.ourmanna.com/verses/api/get/?format=text 2>/dev/null` | |
# Colorize and print the verse to the terminal | |
printf "\n\n\033[01;34m${votd/ - /\\n\\n}\n\n" | |
# Print a dollar sign and a space, signifying a new prompt | |
printf "\033[00m$ " | |
} | |
# Putting the parenthesis around the command with & makes it run in a subshell in parallel | |
(printVotd &) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
votd.sh
chmod +x votd.sh
to make it executablesudo mv /usr/local/bin
to move it into your PATH.bashrc
file, call the commandvotd.sh
Boom! 💥 Whenever you open a new terminal, it will print the verse of the day. 😃
Feedback is welcome! (I'm by no means a bash expert)