Custom Fortune Cookie / Random Tips - Open New Terminal

Apr 12, 2022

Those who are tired of reading the same old repetitive fortune cookies, you have come to the right place to learn the magic of configuring dynamic and more useful tips.


Kindly install the following tools from your package manager

Create a Bash Function to pull from your desired website:

For educational purposes, I’m picking up

curl -s | hxnormalize -x | hxselect 'div.post__content'

In your .rc file (bashrc, .etc,.):

if [ ! "$TIP" ]; then
  fortune 30% linux 30% beam 10% computers 10% science 10% debian 5% wisdom 5% work
  echo "$RANDOM_TIP" | w3m -dump -T 'text/html'
  echo "Pulled from on $(date +'%d-%m-%Y %H:%M:%S')."

The end result should look like the above screenshot Whenever you open a new terminal window or tab. Hope you enjoyed the tutorial!

   linux (5) , unix (5) , shell (1) , terminal (1) , til (4)