scripts

My personal collection of scripts
git clone git://src.gearsix.net/scripts
Log | Files | Refs | Atom | README | LICENSE

commit 6574145487c9dcd0e89f844923026d6b1c9d5f84
parent dcc2f559127816c7f2aafb0c8a64d6706461ca10
Author: GeaRSiX <gearsix@tuta.io>
Date:   Wed, 15 Jan 2020 19:09:11 +0000

added while-true script

Diffstat:
MREADME.md | 4++++
Asrc/while-true.sh | 14++++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -55,6 +55,10 @@ Scripts related to string parsing/manipulation - mkdmv = make directory ($1) and move files into it ($2..$n) - mkdnvim = make directory ($1), touch file ($2) and open file ($2) in nvim +### misc + +- while-true = clear the terminal, run $1 sleep ($2 || 1), repeat forever (Ctrl+C to cancel) + ### depreciated - touchn = create $2 files name $1 appended with 1 to $2 diff --git a/src/while-true.sh b/src/while-true.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# while-true +# description: clear terminal, run $1, sleep ($2 || 1), repeat (Ctrl+C to cancel) +# e.g.$ while-true "git-status" 5 + +while [ true ]; do + clear + $1 + if [[ -z $2 ]]; then + sleep 1 + else + sleep $2 + fi +done