Pages

Tuesday, 26 February 2013

Make STAR WARS message greet you when you open the terminal

I am a great fan of STAR WARS like many of you out there. So I decided to write a script which greets me with star wars message every time I open my Terminal to code.
Suppose say you are using Bash, when you open your terminal the file ~/.bashrc will run. Similarly if you are using Zsh => ~/.zshrc will run. So basically I can just put an echo statement in that to make it greet me every time I open my terminal. Today lets do something more interesting. Someting like this:


To get this you can just download this gist and add the contents in it to ~/.bashrc or ~/.zshrc or ~/.cshrc ..etc depending on which shell you are using. Or you can just copy the following and paste it in ~/.bashrc or ~/.zshrc or ~/.cshrc


2 comments:

  1. You could also do this in a much simpler way.
    Install figlet by
    sudo apt-get install figlet
    Then add these lines in ~/.bashrc
    figlet -f lean -S -c -w `tput cols` STAR | tr ' _/' ' 8'
    figlet -f lean -S -c -w `tput cols` WARS | tr ' _/' ' 8'
    It also gives you the flexibility of changing the message to be printed as well as the character to be printed.You could also chose different font files.

    ReplyDelete
  2. Yeah! you can do that :) Thanx

    ReplyDelete