From 35242ef0a438664930cdcfb3789da8395aa50f8f Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Fri, 03 Jul 2020 02:16:04 -0400 Subject: cmd: Fix non-"static" global variable Broken by commit dcf9e96aa3a3530b6f0e6afba8dc0c102b89dd51. --- (limited to 'src') diff --git a/src/cmd.sh b/src/cmd.sh index 0742fb4..1e94f90 100644 --- a/src/cmd.sh +++ b/src/cmd.sh @@ -19,8 +19,8 @@ # . _cmds=' ' -_cmd_running= -_cmd_running_clean= +cmd_running= +cmd_running_clean= register_cmd() { @@ -114,12 +114,12 @@ run_cmd() cmd_clean="$(printf '%s' "${cmd}" | \ tr '[A-Z]' '[a-z]' | tr -C '[a-z0-9_]' '_')" if is_cmd "${cmd}"; then - _cmd_running="${cmd}" - _cmd_running_clean="${cmd_clean}" + cmd_running="${cmd}" + cmd_running_clean="${cmd_clean}" es=0 "cmd_${cmd_clean}_main" "${@}" || es=${?} - _cmd_running='' - _cmd_running_clean='' + cmd_running='' + cmd_running_clean='' else error "$(get_msg 'cmd_not_found')" "${cmd}" return 1 diff --git a/src/getopt.sh b/src/getopt.sh index 0e63ead..12f3807 100644 --- a/src/getopt.sh +++ b/src/getopt.sh @@ -24,12 +24,12 @@ get_options() local prefix= local opt= - if [ "x${running_cmd_clean}" = 'x' ]; then + if [ "x${cmd_running_clean}" = 'x' ]; then optstring="${OPTSTRING}" prefix='opt_' else - eval "optstring=\"\${cmd_${running_cmd_clean}_optstring}\"" - prefix="cmd_${running_cmd_clean}_opt_" + eval "optstring=\"\${cmd_${cmd_running_clean}_optstring}\"" + prefix="cmd_${cmd_running_clean}_opt_" fi unset OPTARG -- cgit v0.9.1