diff options
author | P. J. McDermott <pjm@nac.net> | 2013-07-16 18:35:02 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-07-16 18:35:02 (EDT) |
commit | bff4ebe5b32e2ceeaccdf9375e80ef62b413a7ee (patch) | |
tree | 37ffe18a13302ddbe50bb8caf1b328c64ea0e67f | |
parent | 4c4dee4825a9a5ecf912cf0bc098dbdd4da221a5 (diff) |
run_cmd(): Clean command name.
-rw-r--r-- | lib/cmd.sh | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -84,10 +84,13 @@ is_cmd() run_cmd() { local cmd="${1}" + local cmd_clean= shift + cmd_clean="$(printf '%s' "${cmd}" | \ + tr '[A-Z]' '[a-z]' | tr -C '[a-z0-9_]' '_')" if is_cmd "${cmd}"; then - "cmd_${cmd}_main" "${@}" + "cmd_${cmd_clean}_main" "${@}" else error 1 "$(get_msg 'cmd_not_found')" "${cmd}" fi |