From 3a84a21b063739b5586b4455d96a1e79cff93ad8 Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Sun, 21 May 2023 12:24:01 +0200
Subject: Add chomp util
---
lib/util.bash | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'lib/util.bash')
diff --git a/lib/util.bash b/lib/util.bash
index c2429a1..7bc8a6d 100644
--- a/lib/util.bash
+++ b/lib/util.bash
@@ -18,6 +18,11 @@ chgdir() {
cd -- "$1" || die "Failed to change directory to $1"
}
+# Removes whitespace surrounding a given text.
+chomp() {
+ awk '{$1=$1};1' <<< "$@"
+}
+
# Create a datetime stamp. This is a wrapper around the date utility, ensuring
# that the date being formatted is always in UTC and respect SOURCE_DATE_EPOCH,
# if it is set.
--
cgit v1.1