--write script to accept a file and open
echo -n "enter a filename: "
read fn
if [ -e $fn ]
then
if [ -f $fn ]
then
if [ -r $fn ]
then
cat $fn
else
echo "no read permission"
#chmod 644 $fn
#cat $fn
#echo "no read permission"
fi
else
echo "it is not a file"
fi
else
echo "$fn file doesnot exist"
fi
--o/p
[chandra@localhost ~]$ sh readpermission
enter a filename: delete
echo " enter a filename "
read n
if rm $n
then
echo " the file is deleted"
else
echo " no such files"
fi
--o/p
[chandra@localhost ~]$ sh readpermission
enter a filename: tyuo
tyuo file doesnot exist