changeset 496:8af33277a2dd

Also implement "err()" in as common shell subroutine
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 30 Aug 2024 16:44:23 +0200
parents fb362bcab722
children eb42828c0cbf
files share/local-bsdtools/common.subr
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/share/local-bsdtools/common.subr	Fri Aug 30 16:42:04 2024 +0200
+++ b/share/local-bsdtools/common.subr	Fri Aug 30 16:44:23 2024 +0200
@@ -38,6 +38,23 @@
 
 
 #:
+#: Display an error message to stderr
+#:
+#: Args:
+#:   $*: The message to print to
+#:
+#: Returns:
+#:   0
+#:
+#: The name of the script is prepended to the error message always.
+#:
+err() {
+    printf "%s: ERROR: %s\\n" "$0" "$*"
+    return 0
+}
+
+
+#:
 #: Display a warning to stderr
 #:
 #: Args: