#!/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