0

I know what your thinking, You and everyone else has always wanted a clock that sits at the top of your command prompt and tells you the time.

Why ?

I made this in first year when i spent countless hours programming and little in bed. I decided i needed somthing that told me all the things i needed to know in one easy location, the top of the screen.. So here it the pauls magical clock of sit on top of my screen.

Sorry about the lack of comments and meaningful varible names, its quite a hacked together little clock

------------------------------------------------------ To use this ---------------------------
Replace 2352318 with your userid (thats my user ID on the box at uni)

add this to your ~/.bashrc

------------------------------------------------------------------------------------------------

clock=()
{
    LENGTH_STRING=27;
    MAILEXISTS=`ls /var/mail | grep -c 2352318`;
    if [ $MAILEXISTS -eq "1" ]; then
        MSGCOUNT=`grep -c "From " $MAIL`;
    else
        MSGCOUNT=0;
    fi;
    col=`tput cols`;
    tput sc;
    tput cup 0 $(( $col - LENGTH_STRING ));
    echo -e -n "\033[1;36m";
    echo -n " Mail:[$MSGCOUNT] [";
    date +"%H:%M] [%e/%b]";
    tput rc
}

PROMPT_COMMAND="clock"
2
Contributors
1
Reply
8
Views
11 Years
Discussion Span
Last Post by Mpiangu
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.