akohan
asked on
How to check permission of a file or path?
Hello,
I know this is possible by "stat" command or "ls" command but I'm looking for a command to return me if $USER (current user) has privilege or permission to a specific /dir1/dir2/a_file
1) Let's say user1 runs script1
2) user1 has access to some paths and no access to some others
3) I need a command to return a true/false value or anything to check it in my script befoer following a procedure.
Thanks
ASKER
Thanks you so much but it has to be in bash.
Thanks again for your resonse.
AkOHAN
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
perl -e 'print 0+-w "/dir1/dir2/a_file"'
perl -e 'print 0+-x "/dir1/dir2/a_file"'