#Finding whether the file has write permission or not


echo "Enter A File Name"
read file


Getting the correct letter indicating the permissions. The letter can be different for the type of user, i.e. the owner, group or all others. You can loop over all permissions and display them. For any particular user type you need to know just checkout the correct position of the character by executing the command "ls -l".

ls -l | grep -w $file | cut -c3-3 > ch
echo $ch
if [ $ch = "w" ]
echo "It has write permissions"
echo "It has no write permissions or file not exists"

Like it on Facebook, Tweet it or share this article on other bookmarking websites.