Check for your errors yourself ...
Code:
#!/bin/csh
# This script will accept a file name as one argument and the word
# read, write or execute as the second argument
# On top of that, it will switch the permissions to the opposite one
if ( $2 == read ) then
if ( -r $1 ) then
chmod +r $1
echo Permission changed to readable
else
chmod -r $1
echo Permission changed to not readable
endif
else
if ( $2 == write ) then
if ( -w $1 ) then
chmod +w $1
echo Permission changed to writeable
else
chmod -w $1
echo Permission changed to not writeable
endif
else
if ( -x $1 ) then
chmod +x $1
echo Permission changed to executable
else
chmod -x $1
echo Permission changed to non executable
endif
endif
endif