send usage to stderr on error paths

This commit is contained in:
2026-08-22 06:17:51 +02:00
parent acac5b685b
commit 4e24ee218c
+7 -7
View File
@@ -221,7 +221,7 @@ while (( $# > 0 )); do
-c|--config) -c|--config)
cfgfile=$1 cfgfile=$1
shift shift
[ -z "$cfgfile" ] && usage && exit 255 [ -z "$cfgfile" ] && echo "Error: missing argument for $opt" >&2 && usage >&2 && exit 255
;; ;;
-h|--help) -h|--help)
usage usage
@@ -232,8 +232,8 @@ while (( $# > 0 )); do
;; ;;
-*) -*)
echo "Error: invalid option: $opt" >&2 echo "Error: invalid option: $opt" >&2
echo echo >&2
usage usage >&2
exit 255 exit 255
;; ;;
*) *)
@@ -247,14 +247,14 @@ while (( $# > 0 )); do
;; ;;
-*) -*)
echo "Error: invalid option: $opt" >&2 echo "Error: invalid option: $opt" >&2
echo echo >&2
usage usage >&2
exit 255 exit 255
;; ;;
*) *)
echo "Error: invalid argument: $opt" >&2 echo "Error: invalid argument: $opt" >&2
echo echo >&2
usage usage >&2
exit 255 exit 255
;; ;;
esac esac