mercredi 8 juin 2016

Bash how to do multiple checks to array entry

i have a question about how check files, i am trying to use the following code:

    if [ -z "${CHECK[0]}" ]; then
    compose $FUNCNAME "Error: Missing plugin! Syntax: plugin_fullpath arg1,arg2,..." 10
    echo 1
    return 10

elif [ -x "${CHECK[0]}" ]; then
    compose $FUNCNAME  "Error: File don't exists or don't have execute permission" 10
    echo 2
    echo "$check"
    return 10

Where ${CHECK[0]} is an array with values, i am passing in that moment "/home/joseluis/Desktop/check_aix_cpu.pl" but my code exit in the second secuence, i don't understand why? an error with the -x check?

Best regards

Aucun commentaire:

Enregistrer un commentaire