File-test Operators
There are a number of operators you can use to test different attributes of a file:
-e file
true if file exists
-o file
true if file exists and is owned by the user
-r file
true if file exists and is readable
-w file
true if file exists and is writable
-x file
true if file exists and is executable
-z file
true if file exists and is zero size
-d dir
true if dir exists and is a directory
eg:
if ( ! -d /home/ditt ) then
mkdir /home/ditt
endif
Attention: there must be space between ( and ! and -d !!
Aucun commentaire:
Enregistrer un commentaire