diff options
author | P. J. McDermott <pj@pehjota.net> | 2017-07-22 15:31:17 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2017-07-22 15:31:17 (EDT) |
commit | 54154676cd12217735ba6ddab0a98dd1cfe9ace0 (patch) | |
tree | c47324d0e16519e33e29d47406d96f0423ff9501 /src | |
parent | 6ecdcfb760811b5f1d7262b224768688e54e4b2c (diff) |
is_cmd(): Use case instead of [, printf, and grep
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd.sh | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -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() |