Register
It is currently Sun Nov 23, 2014 2:42 am

Folder Write Permissions?


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Mon Mar 31, 2008 6:22 pm   

Joined: Mon Mar 31, 2008 6:15 pm
Posts: 2
I need to determine if the current user has write permissions to a specific folder.

I can get the human readable, or the octal file permissions but this doesnt give me what I need, and it would take a lot of code to use these values to determine if this specific user is the owner, part of the writeable group, etc...

Is there a better way to check for write permissions?


Top
 Profile  
 PostPosted: Tue Apr 01, 2008 2:42 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 229
Location: London - UK
Code:
if [ -w './path/to/folder' ]
then
  echo 'yay i can write'
fi


Check 'man test' :)


Top
 Profile  
 PostPosted: Tue Apr 01, 2008 3:09 am   

Joined: Mon Mar 31, 2008 6:15 pm
Posts: 2
Thank you.

All that I know of bash scripting is from google and looking at other scripts and its been difficult to try and find this solution, I may have even encountered it before; however the syntax really doesnt explain what it does (to one not experienced with bash scripting) so I probably just glanced right over it, not knowing what it was.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP