Skip to main content
added link to the answer which was referred to in the text.
Source Link

Just a little tweak on the answer by @orzechow. All credit should go to @orzechow. I just don't know how to put a whole program in a comment.

This is a shell script which can be run like: scriptName 13 to sleep for 13 seconds.

#!/bin/bash
#
# $Id: ohmSleepBar,v 1.2 2025/07/13 11:15:14 bennett Exp bennett $
#
# ohmSleepBar is like sleep with a text bar countdown
#
# First try.  It needs a lot of work.

if [[ -z "$1" ]] ; then
    echo "Usage: $0 <integer>" >&2
    echo "Sleeps for <integer> seconds showing a status bar." >&2
fi

# Clean up $1.
sleepTime=$(printf "%i" "$1" 2> /dev/null)

(for i in $(seq 1 $sleepTime) ; do echo -n . ; sleep 1 ; done) \
    | pv -X -s $sleepTime -F "%t %p"

Caveats: It might need bash. It does need a working seq. It does need a working printf. It requires a newer pv for the -X option. It's not terribly efficient, but it does capitalize on pv's use of the terminal.

Again, this was not my idea, but a sussed out version of @orzechow'sversion of @orzechow's. (thanks!)

-E

Just a little tweak on the answer by @orzechow. All credit should go to @orzechow. I just don't know how to put a whole program in a comment.

This is a shell script which can be run like: scriptName 13 to sleep for 13 seconds.

#!/bin/bash
#
# $Id: ohmSleepBar,v 1.2 2025/07/13 11:15:14 bennett Exp bennett $
#
# ohmSleepBar is like sleep with a text bar countdown
#
# First try.  It needs a lot of work.

if [[ -z "$1" ]] ; then
    echo "Usage: $0 <integer>" >&2
    echo "Sleeps for <integer> seconds showing a status bar." >&2
fi

# Clean up $1.
sleepTime=$(printf "%i" "$1" 2> /dev/null)

(for i in $(seq 1 $sleepTime) ; do echo -n . ; sleep 1 ; done) \
    | pv -X -s $sleepTime -F "%t %p"

Caveats: It might need bash. It does need a working seq. It does need a working printf. It requires a newer pv for the -X option. It's not terribly efficient, but it does capitalize on pv's use of the terminal.

Again, this was not my idea, but a sussed out version of @orzechow's. (thanks!)

-E

Just a little tweak on the answer by @orzechow. All credit should go to @orzechow. I just don't know how to put a whole program in a comment.

This is a shell script which can be run like: scriptName 13 to sleep for 13 seconds.

#!/bin/bash
#
# $Id: ohmSleepBar,v 1.2 2025/07/13 11:15:14 bennett Exp bennett $
#
# ohmSleepBar is like sleep with a text bar countdown
#
# First try.  It needs a lot of work.

if [[ -z "$1" ]] ; then
    echo "Usage: $0 <integer>" >&2
    echo "Sleeps for <integer> seconds showing a status bar." >&2
fi

# Clean up $1.
sleepTime=$(printf "%i" "$1" 2> /dev/null)

(for i in $(seq 1 $sleepTime) ; do echo -n . ; sleep 1 ; done) \
    | pv -X -s $sleepTime -F "%t %p"

Caveats: It might need bash. It does need a working seq. It does need a working printf. It requires a newer pv for the -X option. It's not terribly efficient, but it does capitalize on pv's use of the terminal.

Again, this was not my idea, but a sussed out version of @orzechow's. (thanks!)

-E

Source Link

Just a little tweak on the answer by @orzechow. All credit should go to @orzechow. I just don't know how to put a whole program in a comment.

This is a shell script which can be run like: scriptName 13 to sleep for 13 seconds.

#!/bin/bash
#
# $Id: ohmSleepBar,v 1.2 2025/07/13 11:15:14 bennett Exp bennett $
#
# ohmSleepBar is like sleep with a text bar countdown
#
# First try.  It needs a lot of work.

if [[ -z "$1" ]] ; then
    echo "Usage: $0 <integer>" >&2
    echo "Sleeps for <integer> seconds showing a status bar." >&2
fi

# Clean up $1.
sleepTime=$(printf "%i" "$1" 2> /dev/null)

(for i in $(seq 1 $sleepTime) ; do echo -n . ; sleep 1 ; done) \
    | pv -X -s $sleepTime -F "%t %p"

Caveats: It might need bash. It does need a working seq. It does need a working printf. It requires a newer pv for the -X option. It's not terribly efficient, but it does capitalize on pv's use of the terminal.

Again, this was not my idea, but a sussed out version of @orzechow's. (thanks!)

-E