Though this blog began as a documentation of my foray into digital signal processing, I've decided I would like to continue posting on this site. While the entries I write henceforth may not be related to DSP and audio programming, I may return to the topic in the future.
So, I'd like to begin (again) with a short, neat little script to pimp out your bash prompt on Ubuntu. This configuration will randomly select a word from the Ubuntu dict and provide a definition at startup of the terminal emulator. Follow these steps to get everything set up:
- Ensure that dict is installed, using sudo apt-get -y install dict.
- Install sdcv, a command line dictionary. Along with it, download several of the dictionary "packs". You can follow the instructions in this forum post:
http://askubuntu.com/questions/191125/is-there-an-offline-command-line-dictionary - Add the following lines to your .bashrc:
random_word=$(sed -n "$(($RANDOM % 99999)) p" /usr/share/dict/words)
word=$random_word
if [[ $word == *\'s ]]
then
word=$(echo $word | cut -c-$(echo `expr ${#word} - 2` ))
fi
export word
PS1='[$word]: '
echo -e "\033[1;34m$(sdcv -n $word)\033[0;37m"
That's it! It's not the most robust; sometimes it'll grab a word that can't be defined. Take it, improve upon it, do whatever! Enjoy!
-- End transmission --