summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2024-06-02 04:36:27 +0100
committerKerin Millar <kfm@plushkava.net>2024-06-11 07:11:59 +0100
commit755177bbfcf4c46ad1ac31ad9501a6c8725b1a68 (patch)
treee417459c9aec6da3fe2badd7f31012e13fffe8a9
parentAdd the has_openrc() and has_systemd() functions (diff)
downloadgentoo-functions-755177bbfcf4c46ad1ac31ad9501a6c8725b1a68.tar.gz
gentoo-functions-755177bbfcf4c46ad1ac31ad9501a6c8725b1a68.tar.bz2
gentoo-functions-755177bbfcf4c46ad1ac31ad9501a6c8725b1a68.zip
Add the warn() function
This will be used internally by a forthcoming commit. Signed-off-by: Kerin Millar <kfm@plushkava.net>
-rw-r--r--functions.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/functions.sh b/functions.sh
index 9736747..a97dde7 100644
--- a/functions.sh
+++ b/functions.sh
@@ -474,6 +474,14 @@ vewend()
}
#
+# Prints a diagnostic message prefixed with the basename of the running script.
+#
+warn()
+{
+ printf '%s: %s\n' "${0##*/}" "$*" >&2
+}
+
+#
# Determines whether the first parameter is truthy. The values taken to be true
# are "yes", "true", "on" and "1", whereas their opposites are taken to be
# false. The empty string is also taken to be false. All pattern matching is