Colorful clock of Time

Paul.Esson 0 Tallied Votes 158 Views Share

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"
Mpiangu 0 Newbie Poster

Good but i can't find bash soft ware to run it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.