]> git.tue.mpg.de Git - gsu.git/commitdiff
_gsu_print_available_commands(): Don't abort if set -e is set.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 3 Mar 2015 17:15:52 +0000 (18:15 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 3 Mar 2015 17:15:52 +0000 (18:15 +0100)
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.

subcommand

index 9ebb7eef06d585138d05ecd6d20c8e64e3a5c0fb..3ff31f0a6492e6d3420d533de96d9e02e358825a 100644 (file)
@@ -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'