diff options
author | Patrick Spek <p.spek@tyil.nl> | 2023-05-21 12:24:01 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2023-05-21 12:25:49 +0200 |
commit | 3a84a21b063739b5586b4455d96a1e79cff93ad8 (patch) | |
tree | 54e077183aa1db31fcf9ad815576b112156abf0d /lib | |
parent | a90e94c845cded2aeda7b70ea3ec5d6b6085f44a (diff) |
Add chomp util
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util.bash | 5 |
1 files changed, 5 insertions, 0 deletions
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. |