clear
echo "Enter the filename"
read name
echo
echo "File details"
if [ -f $name ]
then
echo "File exists"
echo -n "file size is:"
wc -c $name
echo -n "File type:"
file $name
if [ -r $name -a -w $name -a -x $name ]
then
echo "File is readable writeable and executable"
elif [ -r $name -a -w $name ]
then
echo "File is readable and writable"
elif [ -r $name ]
then
echo "File is read only"
elif [ -w $name ]
then
echo "File is write only "
elif [ -x $name ]
then
echo "File executable only"
else
echo "File not readable ,writable and executable"
fi
else
echo "File does not exist"
fi
OutPut
Enter the filename
file1
File details
File exists
file size is:27 file1
File type:file1: ASCII text
File is readable and writable
echo "Enter the filename"
read name
echo
echo "File details"
if [ -f $name ]
then
echo "File exists"
echo -n "file size is:"
wc -c $name
echo -n "File type:"
file $name
if [ -r $name -a -w $name -a -x $name ]
then
echo "File is readable writeable and executable"
elif [ -r $name -a -w $name ]
then
echo "File is readable and writable"
elif [ -r $name ]
then
echo "File is read only"
elif [ -w $name ]
then
echo "File is write only "
elif [ -x $name ]
then
echo "File executable only"
else
echo "File not readable ,writable and executable"
fi
else
echo "File does not exist"
fi
OutPut
Enter the filename
file1
File details
File exists
file size is:27 file1
File type:file1: ASCII text
File is readable and writable
We are urgently in need of KlDNEY donors for the sum of $500,000.00 USD, Email for more details:
ReplyDeletehospitalcarecenter@gmail.com
WhatsApp +91 779-583-3215