Wednesday, August 5, 2009

Let Linux Speak Time and Day for You

I have written a single line command that tells time of the day:

$ espeak "Time is `/bin/date \"+%H
hours %M minutes %S seconds\"`"

You need not to type this command every time, just run the

following commands only one time:

$ echo "alias speak_time='espeak \"Time is \`/bin/date \"+%H hours %M minutes %S seconds\"\`\"'" >> ~/.bashrc

$ source ~/.bashrc

Now, you will be able to run speak_time any number of time at any time, and you will get exact time. :-)

$ speak_time

PS: Requirement of above command is "espeak"

$ sudo apt-get install espeak

For speaking day, just add following alias in your .bashrc file

alias speak_day='espeak "Today is `/bin/date \"+%A, %d %B 20%y\"`"'

No comments: