You are on page 1of 3

echo "Enter the file name"

read fn

if [ -z $fn ]

then

echo "Re-enter the file name"



else

if [ -d $fn ]

then

echo "File is directory"

else

a=`ls -l $fn | cut -c 1 `

echo $a



if [ $a = '-' ]

then


echo "file is general file"

fi

if [ a = 'b' ]

then


echo "file is block device file"

fi




if [ $a = 'l' ]

then


echo "file is symbolic link file"

fi



if [ $a = 'c' ]

then


echo "file is character device file"

fi



if [ $a = 's' ]

then


echo "file is socket file"

fi

fi


fi


echo "File permisions are:"

if [ -r $fn ]

then

echo "File is readable"

fi

if [ -w $fn ]

then

echo " File is writable"

fi



if [ -x $fn ]

then

echo "File is executable"

fi

You might also like