[dim PATCH 2/7] dim: return error exit status on unknown subcommands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
 dim | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dim b/dim
index 989674ab7a91..fc72cd619dbd 100755
--- a/dim
+++ b/dim
@@ -1840,11 +1840,12 @@ if ! declare -n subcmd=dim_alias_${subcommand//-/_} &> /dev/null || \
 	subcmd="$subcommand"
 fi
 
-# if there's a function by the subcommand name, call it
+# look up the function by the subcommand name
 subcmd_func=dim_${subcmd//-/_}
-if declare -f $subcmd_func >/dev/null; then
-	$subcmd_func "$@"
-else
+if ! declare -f $subcmd_func >/dev/null; then
 	echoerr "'$subcommand' is not a dim command."
 	dim_usage
+	exit 1
 fi
+
+$subcmd_func "$@"
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux