Friday, 7 October 2016

Check if a file or folder exists

-e for anything, -f for files, -d for folders:

if [ -d /tmp ] ; then
   echo "tmp exists"
else
   echo "it doesn't"
fi

No comments:

Post a Comment