A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

January 22, 2010

Facing problem in testing the file permission

script name: filetest.sh

if [ $# -eq 0 ] ; then
echo " You didn't enter any argument"
elif [ ! -e $1 ] ; then
echo " file not exist"
elif [ ! -r $1 ] ; then
echo " file not readable"
elif [ ! -w $1 ] ; then
echo " file not writable"
else
echo " file both readable and writable"
fi

running like...

$ ./filetest filename

but it showing.....both readable and writable

for those file which are not readable and writable...

Click Here!