From bff4ebe5b32e2ceeaccdf9375e80ef62b413a7ee Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 16 Jul 2013 18:35:02 -0400 Subject: run_cmd(): Clean command name. --- (limited to 'lib') diff --git a/lib/cmd.sh b/lib/cmd.sh index 0558971..fa9b1ad 100644 --- a/lib/cmd.sh +++ b/lib/cmd.sh @@ -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 -- cgit v0.9.1