Gnuru.org
Productive Linux


Subscribe

 Subscribe via Feedburner in a reader

Enter your email address:

Delivered by FeedBurner


Login
Login:
Password:



Don't have an account?
Sign up to Gnuru.org
Forgot your password?

Command Line Timer
14 August 2012 @ 11:46 BST
by Paul

A few ideas for a timer from here:

Here's a script:

#!/bin/bash
echo -n "How many minutes would you like the timer to run? "
read limit
echo
echo "Timing $limit minutes..."
echo
counter=0
while [ $counter != $limit ]; do
   echo "$counter minutes so far...";
   sleep 60
   let "counter = $counter + 1"
done
if [ $counter = $limit ]; then
   echo
   echo "Time's up - $counter minutes have elapsed!"
   echo -e '\a' >&2
   exit 0
fi

Here is a one-liner:

echo -e '\a' >&2; sleep NUMBER; echo -e '\a' >&2

Replace 'NUMBER' with the time as per the sleep manpage.




Comments disabled