From: Andre Noll Date: Tue, 3 Mar 2015 17:15:52 +0000 (+0100) Subject: _gsu_print_available_commands(): Don't abort if set -e is set. X-Git-Url: http://git.tuebingen.mpg.de/?p=gsu.git;a=commitdiff_plain;h=ee0253579a48cddcf022a7978afe68bc57311313 _gsu_print_available_commands(): Don't abort if set -e is set. It was pointed out by Congmao Wang that the example hello.bash script prints only the first subcommand and exits if it is called with an invalid subcommand and set -e is set. This is due to the "let count++" statement which returns 1 in the first iteration of the loop since count is zero. This patch changes the statement to "let ++count" which returns zero in all cases. --- diff --git a/subcommand b/subcommand index 9ebb7ee..3ff31f0 100644 --- a/subcommand +++ b/subcommand @@ -58,7 +58,7 @@ _gsu_print_available_commands() printf 'Available commands:\n' for cmd in $gsu_cmds; do printf '%s' "$cmd" - let count++ + let ++count if (($count % 4)); then printf '\t' ((${#cmd} < 8)) && printf '\t'