Quantcast
Viewing latest article 1
Browse Latest Browse All 2

A little sleeper function in bash to replace native sleep command with some progress output

Image may be NSFW.
Clik here to view.
Facebook
Image may be NSFW.
Clik here to view.
Share

This is a small function I wrote (which I call sleeper), that I use in some of my bash scripts when there is a sleep for XX seconds, and I want to know how many seconds passed:

#!/bin/bash

interval=1
while [ "$interval" -lt 120 ] ; do
  echo -ne "$interval\r"
  sleep 1
  let "interval=$interval + 1"
done

I also have it here: http://pastebin.com/C4vweaUu

Image may be NSFW.
Clik here to view.
Facebook
Image may be NSFW.
Clik here to view.
Share


Viewing latest article 1
Browse Latest Browse All 2

Trending Articles