Skip to content

Commit

Permalink
Corrected bug: result was not transmitted when command returns on error
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jan 24, 2019
1 parent fa53a97 commit a070dcd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions getopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ function getopt_read_arg() {
[ ${#getopt_args[@]} -lt 1 ] && return 1

local arg="${getopt_args[0]}"

if [[ "_${arg:0:1}" == "_-" ]] && [[ $getopt_parse_options -eq 1 ]]
then
# parse option
Expand Down Expand Up @@ -642,7 +642,7 @@ function getopt_read_arg() {
local action=${getopt_actions[$index_arg]}

# execute action
$action "${getopt_args[@]}"
$action "${getopt_args[@]}" || exit $?

# no more options after command, all is transmitted to child command
unset getopt_args
Expand Down

0 comments on commit a070dcd

Please sign in to comment.