Pages

Tuesday, March 19, 2013

Write a script to check the given type of file?


$vi type_file.sh
echo “enter file name:”
read fname
if [ -e $fname ]
then
if [ -f $fname ]
then
echo “regular file “
else
echo “directory file “
elif [ -l $fname ]
then
echo ” link file”
elif [ -b $fname -o -c $fname ]
then
echo “Device file”
fi
:wq

No comments:

Post a Comment