summaryrefslogtreecommitdiff
path: root/localless
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2021-11-24 23:29:18 +0100
committerJonas Smedegaard <dr@jones.dk>2021-11-24 23:29:18 +0100
commite5ed803e16d7c5a64d6e9452c652c074a2859af0 (patch)
treec9227310a4729fef328271da1ce1b0de61c68bef /localless
parent20fdf4f3ee0828d377dbd1735166cb4927a1d690 (diff)
add script localless
Diffstat (limited to 'localless')
-rwxr-xr-xlocalless38
1 files changed, 38 insertions, 0 deletions
diff --git a/localless b/localless
new file mode 100755
index 0000000..773f7a5
--- /dev/null
+++ b/localless
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Copyright © 2021 Jonas Smedegaard <dr@jones.dk>
+# Description: pipe a command to less with INT signal blocked
+#
+# This program is free software;
+# you can redistribute it and/or modify it
+# under the terms of the GNU General Public License
+# as published by the Free Software Foundation;
+# either version 2, or (at your option) any later version.
+#
+# Thanks to Jakub Wilk <jwilk@debian.org> for the trick
+#
+# Depends: less
+
+set -e
+
+PRG=$(basename "$0")
+
+showhelp() {
+ cat <<EOF
+Usage: $PRG command [opetions...]
+
+Example: $PRG journalctl -ef
+EOF
+}
+
+exit1() {
+ echo "ERROR: $1"
+ exit 1
+}
+
+if [ $# -eq 0 ]; then
+ showhelp
+ exit1 "not enough parameters"
+fi
+
+exec env --ignore-signal=INT "$@" | less