Script program is not recognizing the -w

Sorry I put -r I ment to out -w but its not perform none of -w, -r, -x flags
Using centos 6.4

#!/bin/bash
echo -e "enter the name of file :\c"
read file_name

if [ -f $file_name ]
then
        if [ -w $file_name ]
        then
          echo "Type some text date. Tp quit press crtl-"
          cat >>  $file_name
        else
          echo "The file does not have permission"
        fi
    else
      echo "$file_name not exists"
 fi

I'm not sure i follow.
I cannot see -w option handled in code.

Can you be more precise on your problem and write exactly what you need / want your script to do ?

Regards
Peasant.

Hi

You write to the file but check for readability

Moderator comments were removed during original forum migration.