jeudi 29 octobre 2015

Test if directory exists or not

Here is my code, and it works but it always says that directory exist, doesnt matter what I write. Moreover it does not print a variable in echo $DIRECTORY. What I need to fix?

#!/bin/sh

if [ -d $DIRECTORY ]; then
echo "Directory exists"
elif [ ! -d $DIRECTORY ]; then
echo "Directory does not exists"
fi
echo $DIRECTORY

Aucun commentaire:

Enregistrer un commentaire