Open Means Open Means

#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" ]
then
echo "It has write permissions"
else
echo "It has no write permissions or file not exists"
fi

No comments

Login to post a comment

Show
  • Create an account
  • Forgot your username?
  • Forgot your password?

Related Articles

  • Using command line argument in Shell Script
  • Shell Script to demonstrate functions
  • Earn money by posting articles
  • Know When Do You Have To Sell Your Mutual Funds
  • HTML Basics - Formatting Tags
  • HTML Basics - Drawing Tables
  • Java Puzzle - Problem of Two Developers
  • Demonstration of Fibonacci Series Using Recurssion
  • Demonstration of Selection Sort on Character Array
  • Most Dangerous Computer Viruses of the Century
  • About Us
  • Faqs
  • Contact Us
  • Disclaimer
  • Terms & Conditions