The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Finding difficult in installing gcc-3.4.6 complier on Solaris 10. susainaj SUN Solaris 4 07-11-2008 10:35 AM
so difficult question about using grep shrimpy UNIX for Dummies Questions & Answers 2 03-22-2008 12:19 AM
difficult sed command Dave724001 UNIX for Advanced & Expert Users 17 09-29-2006 05:11 AM
difficult time differences Lokesha SUN Solaris 1 06-20-2006 10:42 AM
Difficult Filtering Problem Piyush UNIX for Advanced & Expert Users 1 06-30-2003 04:06 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-07-2008
DNAx86 DNAx86 is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 69
Question A difficult script (for me)

Hi,
I'm a beginners, this is one of my first script, it's easy, but I don't know how to write this script:

The script receive in input 4 parameters:
1) user_name
2) r and/or w and/or x ( rwx, rw, x, ....)
3) u and/or g and/or o ( u, uo, ugo, ...)
4) the path name

The script print a list of normal files ( “-” with ls) created by user_name, with at least the permission specified as 2nd parameters for the groups specified as 3rd parameter , starting from the path name passed as 4th parameter.

Example of permission:
giving: rw, u
I look for “ rw-......“ using ls -lr (. is a generic character)
giving: rw, ugo
I look for “ rw-rw-rw- “

I tryed in many ways, but for example i f I execute a simple script like this:
permission=-rw-r--r--
ls -lR | grep '^-$permission'

The script don't print anything on the screen, but I type in the shell:
ls -lR | grep '^-rw-r--r--'
the output is correct.

Moreover I don't know how to separate the colums of ls -lR using CUT (I suppose) to select oly the rows that are created by the user

So I understood I need help. Please help me.
PS: i have to write many script, and this is the simplest, so if I don't know how to write this, I'll never be able to write the others..

Last edited by DNAx86; 01-07-2008 at 01:36 PM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:13 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0