diff options
author | xyz <gky44px1999@gmail.com> | 2022-04-27 01:44:02 -0700 |
---|---|---|
committer | xyz <gky44px1999@gmail.com> | 2022-04-27 01:44:02 -0700 |
commit | 7f471f2fddfb2421bbc2916258c77326e774b9ef (patch) | |
tree | 521949c72295f73ee63b7803debae92b3005b17d /home/xyz/.local | |
parent | 14062b9253cc3192a59c423da4aaac5603f1cff8 (diff) |
loop scripts
Diffstat (limited to 'home/xyz/.local')
-rwxr-xr-x | home/xyz/.local/bin/f | 23 | ||||
-rwxr-xr-x | home/xyz/.local/bin/fsr | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/home/xyz/.local/bin/f b/home/xyz/.local/bin/f new file mode 100755 index 00000000..575f0a28 --- /dev/null +++ b/home/xyz/.local/bin/f @@ -0,0 +1,23 @@ +#!/bin/sh + +while getopts t: opt; do + case $opt in + t) time="$OPTARG";; + \?) exit 1;; + esac +done +shift $((OPTIND-1)) + +while :; do + # suggested by https://github.com/koalaman/shellcheck/wiki/SC2294 + "$@" + sleep "${time:-1}" +done + +# tests? +#f ls -lah -- -l +#f printf 'echo 1; echo 2' +#f printf 'haha %d lala' 10 + +# tips +#f eval 'echo 1; echo 2' diff --git a/home/xyz/.local/bin/fsr b/home/xyz/.local/bin/fsr new file mode 100755 index 00000000..1687ec98 --- /dev/null +++ b/home/xyz/.local/bin/fsr @@ -0,0 +1,3 @@ +#!/bin/sh + +f ssh "pi@${1:-raspberrypi}.local" |