vendredi 23 mars 2018

Shell how to test every input for file

so i am doing a shell script and am trying to figure out how to do this safe guard function:

if ! [[ -e "$@" ]]; then
    echo"Not a file!"
    exit 0
fi

my ideia is to check every input for file. so when i call the script: ./scriptname file1.txt file2.tar NOTfile4 it will output NOT a file

Aucun commentaire:

Enregistrer un commentaire