aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-11-11 00:16:13 +0700
committerShulhan <ms@kilabit.info>2024-11-11 00:21:59 +0700
commit5b3d80980f48a28f217dfdf95167e0e7ae542392 (patch)
tree5048df3a1bb5120241407fa48d5cd6b0f570a55e
parentbc89bb8018ebd93f1327ca48a49369b93d37b5f8 (diff)
downloadbin.sh-5b3d80980f48a28f217dfdf95167e0e7ae542392.tar.xz
bin: add script timer.sh
The timer.sh diplay a message after X duration.
-rwxr-xr-xbin/timer.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/bin/timer.sh b/bin/timer.sh
new file mode 100755
index 0000000..48698dd
--- /dev/null
+++ b/bin/timer.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+## SPDX-FileCopyrightText: 2022 M. Shulhan <ms@kilabit.info>
+## SPDX-License-Identifier: GPL-3.0-or-later
+
+##
+## Script to display message after X duration.
+##
+## Usage
+##
+## $ timer.sh $TIME [$MESSAGE]
+##
+## The $TIME parameter is any format that is acceptable by sleep, for example
+## 60, 1m, 2h.
+## The $MESSAGE parameter is optional.
+##
+
+DELAY=$1
+MESSAGE=$2
+
+sleep "$DELAY"
+notify-send "Time out" "$MESSAGE"