From 94edfe8c7b2f83650c0f6262e50063ebcdedf29d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 18 Apr 2018 15:18:05 +0200 Subject: minSleep --- rolling-directory | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'rolling-directory') diff --git a/rolling-directory b/rolling-directory index d85f8b7..ce97021 100644 --- a/rolling-directory +++ b/rolling-directory @@ -33,16 +33,25 @@ case "${1}" in monitor) shift + sleep="" typeset -a inotifyExtra inotifyExtra=() - if [[ "${1}" = <-> ]]; then - inotifyExtra=(-t "${1}") - shift - fi + while getopts 's:t:' opt; do + case "${opt}" in + s) + [[ "${OPTARG}" = <-> ]] || exit 2 + sleep=${OPTARG} + ;; + t) + [[ "${OPTARG}" = <-> ]] || exit 2 + inotifyExtra+=(-t "${OPTARG}") + esac + done while resize + [[ -n "$sleep" ]] && sleep ${sleep} inotifywait -qq -r ${dir} ${inotifyExtra} \ -e modify \ -e close_write \ -- cgit v1.2.3