Qwotes
Thumbnail
Nov 20 2022
Script to display quotes on terminal startup

Link to GitHub repository

Qwotes is a simple bash script to display quotes on terminal startup (or anywhere!). For instructions regarding installation, read the README from the repository.

Dependencies

Qwotes depends on

Working

Qwotes makes a GET request to api.quotable.io/random, the random endpoint to get a random quote, then parses the response body using jq to take the quote and its author and places it in two text files, called author.txt, and qwote.txt in the ~/.cache directory.

Then the following code to be put in ~/.bashrc reads from the text files and displays it on the terminal everytime the shell is sourced i.e started.

echo
echo -en "${RED}\e[3m❤ $(cat ~/.cache/qwote.txt) ❤\e[0m${NC}"
echo -en "\n${BLUE}\e[3m- $(cat ~/.cache/author.txt)\e[0m${NC}"
echo

The above code will display the same quote every time the shell is sourced. To refresh, or get a new quote, simply run qwotes again and source ~/.bashrc.

You can read from the text files that were generated upon running qwotes in your own applications too.