summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2024-11-04 20:23:13 +0100
committerErich Eckner <git@eckner.net>2024-11-04 20:23:13 +0100
commit0eed088d428b1ac53f005602bcf2fb585be30b43 (patch)
tree99bb4280450a83100b7c0fefce360b887d24687c
parent9197f35b32ea7a218e49588ac167bebd248e8576 (diff)
downloadcomputer-time-limit-0eed088d428b1ac53f005602bcf2fb585be30b43.tar.xz
refactoring
-rwxr-xr-xcomputer-time-limit24
1 files changed, 12 insertions, 12 deletions
diff --git a/computer-time-limit b/computer-time-limit
index 80fc98c..a3a05cb 100755
--- a/computer-time-limit
+++ b/computer-time-limit
@@ -35,20 +35,20 @@ sende_msg() {
}
wie_lange_noch() {
- if [ -f "$1" ]; then
- erg=$(
- sende_msg start "$1"
- )
- if [ -n "${erg}" ] && ! echo "${erg}" | grep -qvx '[0-9]\+'; then
- noch="${erg}"
- ab=$(date +%s)
- else
- noch=$((ab+noch-$(date +%s)))
- ab=$(date +%s)
- fi
- else
+ if [ ! -f "$1" ]; then
noch=0
ab=$(date +%s)
+ return
+ fi
+ erg=$(
+ sende_msg start "$1"
+ )
+ if [ -n "${erg}" ] && ! echo "${erg}" | grep -qvx '[0-9]\+'; then
+ noch="${erg}"
+ ab=$(date +%s)
+ else
+ noch=$((ab+noch-$(date +%s)))
+ ab=$(date +%s)
fi
}