summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. 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)
commit54154676cd12217735ba6ddab0a98dd1cfe9ace0 (patch)
treec47324d0e16519e33e29d47406d96f0423ff9501
parent6ecdcfb760811b5f1d7262b224768688e54e4b2c (diff)
is_cmd(): Use case instead of [, printf, and grep
-rw-r--r--src/cmd.sh5
1 files changed, 3 insertions, 2 deletions
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 <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()