Shell script works in bash but not in ksh -
i need write script test if command blablabla exists in classpath. wrote following code:
if ! hash blablabla >/dev/null 2>&1; echo not found fi
this works fine when script executed in bash. if try in ksh, doesn't work:
#! /usr/bin/ksh if ! hash blablabla >/dev/null 2>&1; echo not found fi
i expect echo not found
executed instead nothing. what's problem?
i believe command portable (if matters):
command -v -- some_command >/dev/null 2>&1 || printf '%s\n' "not found"
Comments
Post a Comment