CodeLibary.com - code examples
  Home  Submit  Free Hosting  Link To Us  Contacts

Bash Running seconds

Bash Running seconds Bash Bash Running seconds Download (.zip)

#!/bin/bash

TIME_LIMIT=10
INTERVAL=1

echo
echo "Hit Control-C to exit before $TIME_LIMIT seconds."
echo

while [ "$SECONDS" -le "$TIME_LIMIT" ]
do
  if [ "$SECONDS" -eq 1 ]
  then
    units=second
  else  
    units=seconds
  fi

  echo "This script has been running $SECONDS $units."
  #  On a slow or overburdened machine, the script may skip a count
  #+ every once in a while.
  sleep $INTERVAL
done

echo -e "\a"  # Beep!

exit 0

  • BashRunning seconds

  Sponsored Links

  Partners
My Linux Space




Home | Bookmark Us | Terms of Use | Link to us | Contact Us

Programming sites at Top100.ws Tatet 

Copyright 2007 © CodeLibary.com, All rights reserved.

Bash Running seconds