Write a linux shell program to perform to check the given file is a directory or not
To check the given file is a directory or not
Code:
clear
echo ---------------------------------------------
echo '\t Check directory or not'
echo ---------------------------------------------
echo Enter the file name
read fname
if [ -d $fname ]
then
echo It is a directory.
else
echo It is not a directory.
fi
Output:
---------------------------------------------
Check directory or not
---------------------------------------------
Enter the file name
sat
It is not a directory.
Leave a Comment