perl script to check read/write/execute permission for 'others'


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl script to check read/write/execute permission for 'others'
# 1  
Old 08-23-2012
perl script to check read/write/execute permission for 'others'

I want to check access rights permissions not for 'user', not for 'group', but for 'others'.

I want to do it by system command in which i want to use 'ls -l' and 'awk' command.

I have written the following program :

PHP Code:
#!/usr/bin/local/perl
#include <stdlib.h>

system ("ls -l | awk '/^-......r../ {print $9 "  is readable for others}' ");
system ("ls -l | awk '
/^-.......w./ {print $"  is writable for others}' ");
system ("ls -l | awk '/^-........x/ {print $9 "  is executable for others}'"); 
I have tried most of the system command syntax, google can give.. have also tried with open and exec.. but all efforts in vain


grateful if you help..


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.


Moderator's Comments:
Mod Comment Double post. Closed.

Last edited by Scott; 08-23-2012 at 04:52 AM.. Reason: zaxxon: code tags; Scott: closed
# 2  
Old 08-23-2012
you can check with stat

Code:
 
perldoc -f stat

stat - perldoc.perl.org
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Checking if the directory has read and write permission

logMsg='Started by '${USER} LOG_MESSAGE "${logMsg}" resultCode=$? if ]; then return ${resultCode} fi touch ${FILELISTPATH} resultCode=$? if ]; then logMsg='failed to create file list:'${FILELISTPATH} LOG_ERROR "${logMsg}" CUSTOM_PREPROCESS ${FATAL} ... (2 Replies)
Discussion started by: raka123
2 Replies

2. Shell Programming and Scripting

Find list of files missing read & execute permission

Hi, I'm writing a post-upgrade script and I want to find which files don't have read and execute to everyone. I can run a find . ! -perm, but then I have to use a list of the possible permissions (777,775, 755 etc). Is there a more elegant solution? Thanks (2 Replies)
Discussion started by: Catullus
2 Replies

3. UNIX for Advanced & Expert Users

Allow user without dir write permission to execute a script that creates files

In our project we have several unix scripts that trigger different processes. These scripts write logs to a particular folder 'sesslogs', create output data files in a separate directory called 'datafiles' etc. Usually L1 support team re-run these scripts . We donot want L1 support team to have... (14 Replies)
Discussion started by: waavman
14 Replies

4. Shell Programming and Scripting

Need a UNIX/perl script to read and write the data

Hi, I have on Designdocument in that information is stored with in tabular format.I need Perl/unix script to read and write the data using perl script? Regards, Ravi (4 Replies)
Discussion started by: toravi.pentaho
4 Replies

5. Shell Programming and Scripting

Need a perl script to read and write the data

Hi, I have on Designdocument in that information is stored with in tabular format.I need Perlscript to read and write the datausing perl script? Regards, Ravi (0 Replies)
Discussion started by: toravi.pentaho
0 Replies

6. Ubuntu

how to make others have read/write permission when the aotu mounted usb flash disk pluge in ?

hi all: as we know , when usb flash disk plug in and aotu mounted , the default permission of the usb flash disk is 700. that means others have no permission . the question: how to make others have read/write permission when the aotu mounted usb flash disk pluge in ? thanks !! (0 Replies)
Discussion started by: arnold.king
0 Replies

7. UNIX for Dummies Questions & Answers

About read,write & execute permissons of a directory

Hi all, I want to know differences between read,write & execute permissons given to directory. Thanx in advance. (6 Replies)
Discussion started by: vishwasrao
6 Replies

8. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

9. UNIX for Advanced & Expert Users

Script without read permission but execute the script

I have a script, except me no one can read the script but they can execute the script. Is it possible? (14 Replies)
Discussion started by: kingganesh04
14 Replies

10. UNIX for Dummies Questions & Answers

Default read/write/execute permissions

I am perplexed that my script execution is not always consistent in creating new files. Specifically, my group read/write/execute permissions. For instance, take a look at the following: -rw-rw---- 1 jg dp 18648 Aug 22 10:06 nx081508.txt -rw-rw---- 1 jg dp 22422 Aug 22 10:06... (1 Reply)
Discussion started by: joeyg
1 Replies
Login or Register to Ask a Question