Created
January 7, 2014 00:02
-
-
Save ArtiomL/8292332 to your computer and use it in GitHub Desktop.
rp - Command Repeater
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# rp - Command Repeater | |
# (CC0) No Rights Reserved | |
# Artiom Lichtenstein | |
# v1.1, 05/01/2014 | |
shopt -s expand_aliases | |
source ~/.bash_aliases | |
if [ -z "$1" ] | |
then | |
echo; echo "Usage: ./rp {COMMAND} [INTERVAL]"; echo | |
exit | |
fi | |
flt_INTERVAL=0.5 | |
int_COUNT=1 | |
flt_TIME=0 | |
if [ $# -eq 2 ] | |
then | |
flt_INTERVAL=$2 | |
fi | |
while true | |
do | |
echo "$(tput setaf 2)$(tput bold)Count: $int_COUNT$(tput sgr0) , $(tput setaf 6)$(tput bold)Time: $flt_TIME sec.$(tput sgr0)" | |
eval $1 | |
sleep $flt_INTERVAL | |
flt_TIME=`echo $int_COUNT \* $flt_INTERVAL | bc` | |
let int_COUNT+=1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment