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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -