From 5c26176cc8ca12e821b26da8c2d79fa16897c55f Mon Sep 17 00:00:00 2001 From: emma Date: Sun, 24 Dec 2023 02:45:29 -0700 Subject: [PATCH] fixed no exit status on usage --- which | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/which b/which index b6b16bf..d8f5293 100755 --- a/which +++ b/which @@ -7,10 +7,12 @@ # permitted in any medium without royalty provided the copyright notice and this # notice are preserved. This file is offered as-is, without any warranty. +set -e argv0="$0" if test -z "$1"; then printf "Usage: %s command...\n" "$0" 1>&2 + exit 64 # sysexits.h(3) EX_USAGE fi while test -n "$1"; do @@ -18,7 +20,7 @@ while test -n "$1"; do location="$(printf "%s\n" "$out" | sed -n 's/.\+ .\+ //p')" if [ "$location" = "found" ]; then - printf "%s: %s.\n" "$argv0" "$out" 1>&2 + printf "%s: %s: Command not found.\n" "$argv0" "$1" 1>&2 exit 69 # sysexits(3) EX_UNAVAILABLE else printf "%s\n" "$location"