vendredi 1 septembre 2017

Test if program exists in Bash Script - abbreviated version

I want to use the abbreviated if then else to determine if ccze exists before using it... and I just cannot get that first part right...

test() {
    [  $(hash ccze) 2>/dev/null ] && echo "yes"  || echo "no"
}

The above is just test.. what am I doing wrong? It does not matter if ccze exists or not - I'm getting "no"

Aucun commentaire:

Enregistrer un commentaire