Checking for a directory in shell program
by rajesh[ Edit ] 2008-08-08 12:10:22
In shell scripting or programming we can check the availability of a directory using the following code
example 1:
if [ -d "directory path" ]
then
echo "The directory is available"
else
echo "No such directory"
fi
example 1: using test command
if ! test -d "directory path"
then
echo "The directory is available"
else
echo "No such directory"
fi