LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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
  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: 66
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



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



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:56 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration