LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 10-18-2004, 04:20 AM   #1
Ollir
LQ Newbie
 
Registered: Aug 2004
Posts: 12

Rep: Reputation: 0
Listing permissions with shell script


Hi,

I need to create a shell scipt, that lists the number of all files in a directory that the currently logged user has read permission, write permission and execute permissions. I'm trying to use the find-command with the -perm option, but is there a simple way to list all files with atleast read permissions etc? I mean not having to type tens of commands for ...-perm 400... -perm -444 and so on. Simple problem, but not for me
 
Old 10-18-2004, 06:50 AM   #2
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
Number of files, in a directory /a/dir, for which current user has read, AND write, AND execute, permissions:
Code:
find /a/dir/ -perm -700 -print | wc -l
Number of files, in a directory /a/dir, for which current user has at least read permission:
Code:
find /a/dir/ -perm -400 -print | wc -l
Number of files, in a directory /a/dir, for which current user has read, OR write, OR execute, permissions:
Code:
find /a/dir/ -perm +700 -print | wc -l
Yves.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
How can I write a shell script to transfer files and keep permissions? LancerNZ Linux - Networking 1 02-24-2005 03:49 AM
How can I write a shell script to transfer files and keep permissions? LancerNZ Linux - Wireless Networking 0 02-24-2005 12:19 AM
listing sequences of files to the shell jimmyj90 Linux - Newbie 4 10-20-2004 05:18 PM


All times are GMT -5. The time now is 05:09 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration