From 54154676cd12217735ba6ddab0a98dd1cfe9ace0 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 22 Jul 2017 15:31:17 -0400 Subject: is_cmd(): Use case instead of [, printf, and grep --- (limited to 'src') diff --git a/src/cmd.sh b/src/cmd.sh index 5ec67bf..1ed69b2 100644 --- a/src/cmd.sh +++ b/src/cmd.sh @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -cmds= +cmds=' ' register_cmd() { @@ -96,7 +96,8 @@ is_cmd() { local cmd="${1}" - [ "x$(printf '%s\n' ${cmds} | grep "^${cmd}$")" = "x${cmd}" ] + case "${cmds}" in *" ${cmd} "*) return 0;; esac + return 1 } run_cmd() -- cgit v0.9.1