Skip to content

Instantly share code, notes, and snippets.

@KrashLeviathan
Created November 10, 2016 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KrashLeviathan/238241f7887135f59ddea905f99cf528 to your computer and use it in GitHub Desktop.
Save KrashLeviathan/238241f7887135f59ddea905f99cf528 to your computer and use it in GitHub Desktop.
Command Line Verse of the Day
#!/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 &)
@KrashLeviathan
Copy link
Author

  1. Install HTTPie
  2. Download votd.sh
  3. Run chmod +x votd.sh to make it executable
  4. Run sudo mv /usr/local/bin to move it into your PATH
  5. At the end of your .bashrc file, call the command votd.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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment