Thursday, February 21, 2008

Keyboard shortcuts at bash prompt

Alt + < - Move to the first line in the history
Alt + > - Move to the last line in the history
Alt + ? - Show current completion list
Alt + * - Insert all possible completions
Alt + / - Attempt to complete filename
Alt + . - Yank last argument to previous command
Alt + b - Move backward
Alt + c - Capitalize the word
Alt + d - Delete word
Alt + f - Move forward
Alt + l - Make word lowercase
Alt + n - Search the history forwards non-incremental
Alt + p - Search the history backwards non-incremental
Alt + r - Recall command
Alt + t - Move words around
Alt + u - Make word uppercase
Alt + backspace - Delete backward from cursor
Ctrl + a - Jump to the start of the line
Ctrl + b - Move back a char
Ctrl + c - Terminate the command
Ctrl + d - Delete from under the cursor
Ctrl + e - Jump to the end of the line
Ctrl + f - Move forward a char
Ctrl + k - Delete to EOL
Ctrl + l - Clear the screen
Ctrl + r - Search the history backwards
Ctrl + R - Search the history backwards with multi occurrence
Ctrl + u - Delete backward from cursor
Ctrl + xx - Move between EOL and current cursor position
Ctrl + x @ - Show possible hostname completions
Ctrl + z - Suspend/ Stop the command

Fun with bash - Addition at bash prompt

Addition at bash prompt can be done in many ways. I have managed to collate some of them in the script below. The script below counts from 1 to 14 in 14 different ways. Its fun isn't it. It shows how powerful and feature-rich this simple scripting language is.

#!/bin/bash
n=1;
echo -n "$n, "
let "n = $n + 1"
echo -n "$n, "
: $((n = $n + 1))
echo -n "$n, "
(( n = n + 1 ))
echo -n "$n, "
n=$(($n + 1))
echo -n "$n, "
: $[ n = $n + 1 ]
echo -n "$n, "
n=$[ $n + 1 ]
echo -n "$n, "
let "n++"
echo -n "$n, "
(( n++ ))
echo -n "$n, "
: $(( n++ ))
echo -n "$n, "
: $[ n++ ]
echo -n "$n, "
n=`echo "$n + 1" | bc`
echo -n "$n, "
n=`echo "$n + 1" | bc -l`
echo -n "$n, "
n=`expr $n + 1`
echo "$n"

Wednesday, February 20, 2008

Adaruvan Vayya

I love this poem written by ONV recited by Madhusoodanan Nair, specially the last three lines


Irulin mahaanidrayil ninnunarthi nee niramulla jeevitha peeli thannu
ente chirakinaakashavum nee thannu ninn aathma shikirathil oru koodu thannu

Oru kunju poovilum thalirkaatilum ninne neeyayi manakunnathengu vere...
jeevanozhukumbol oruthulli ozhiyathe neethanne nirayunna puzhayengu vere...
kanavinte ithalaayi ninne padarthi nee viriyichoraakashamengu vere...

Oru kochu raapadi karayumbozhum nerthoraruvi than thaarattu thalarumbozhum
kaniviloru kallu kanimadhuramavumbozhum kaalamidarumpozhum ninte -
hridayathil njanente hridayam koruthirikunnu...
ninill abhayam thiranju pokunnu...

Adaruvan vayya..... nin hridayathil ninnenikethu swargam vilichaalum
uruki nin aathmaavin aazhangalil veenu poliyumbozhaanente swargam
ninnil adiyunnathee nitya sathyam

See the video of the song from the film Daivathinte Vikrithikal

The opening ceremony

Well.. I'm here ..
Lemme open this with a note to my sweetheart..

You're my best friend in the good times
and my rock in times of sorrow.
You're the reason for sweet yesterdays
and my promise for tomorrow.

My love, The sea nor land, nor death itself can extinguish or lessen toward you, most endearedly visits you with eternal embraces, and will abide with you for ever: and may the God of my life watch over you, and bless you, and do you good in this world, and for ever.