diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-07-03 02:16:04 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-07-03 02:17:23 (EDT) |
commit | 35242ef0a438664930cdcfb3789da8395aa50f8f (patch) | |
tree | 1ab6b97865fec94202be323517ab9605e8405748 /src | |
parent | 66c3162f152c9befa0b2ee032300b526a3240d23 (diff) |
cmd: Fix non-"static" global variable
Broken by commit dcf9e96aa3a3530b6f0e6afba8dc0c102b89dd51.
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd.sh | 12 | ||||
-rw-r--r-- | src/getopt.sh | 6 |
2 files changed, 9 insertions, 9 deletions
@@ -19,8 +19,8 @@ # <http://www.gnu.org/licenses/>. _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 |