List All the Scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting List All the Scripts
# 1  
Old 06-09-2010
List All the Scripts

Hi there.

I need to list all the sh extension files, from a particular user, that exists on a computer. How can I do it?

Thanks for reading.
# 2  
Old 06-09-2010
Check the -user option in the man page of find.
# 3  
Old 06-09-2010
Quote:
Originally Posted by Franklin52
Check the -user option in the man page of find.
Hi Franklin52.

Actually I do this:
Code:
find / -user user_name | grep "*.sh"

It works but it only search into directories that resides under the path of the script and I want to do it all over the HD. Any idea?

Thanks for reading.
# 4  
Old 06-09-2010
find / really should search all over the disk. can you give an example of a file it's not finding? A directory in its path might really be a symlink to somewhere else. Or you might simply not have permissions to search those directories.
# 5  
Old 06-14-2010
Sorry but I could not answer before. I have solved the problem but I still have a doubt. The next first code give me all the scripts of my computer but also give me some files that ends with ".bsh". Why I get this files if I'm only searching for ".sh$" files?
Code:
find / -user user_name 2> /dev/null | grep ".sh$"

Thanks for reading.
# 6  
Old 06-14-2010
Hi.

Because in a regular expression a dot matches anything. Escape the dot

Code:
find / -user user_name 2> /dev/null | grep "\.sh$"

Is it not better to do something like:

Code:
find / -name "*.sh" -user user_name 2> /dev/null

This User Gave Thanks to Scott For This Post:
# 7  
Old 06-14-2010
Quote:
Originally Posted by scottn
Hi.

Because in a regular expression a dot matches anything. Escape the dot

Code:
find / -user user_name 2> /dev/null | grep "\.sh$"

Is it not better to do something like:

Code:
find / -name "*.sh" -user user_name 2> /dev/null

Yes, I use the second code but about the first code, I have solved the problem escaping the dot. The problem was that I have proved to scape the dot, before your answer, but not using quotes. Using quotes like this "\.sh$", it works.

Many thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running scripts from a list

I am writing a bash script to run test some scripts. The names scripts of the scripts to tests are stored in an array. scptArr='chcksfrd.bash' scptArr='compute-misfit.bash' scptArr='compute-travel-times.bash' scptArr='create-data-tinv.bash' scptArr='create-docs.bash' ... (3 Replies)
Discussion started by: kristinu
3 Replies

2. OS X (Apple)

Apple scripts and "get from list

i have this code that i want to run but it is not working i.e if the user slected say production it will then run the command for production any ideas what i need to change set question to choose from list {"production"} set answer to question if answer question is "Production: then ... (5 Replies)
Discussion started by: ab52
5 Replies

3. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

4. UNIX for Dummies Questions & Answers

shell scripts - list dead users accts and include a count at the end?

I am trying to show the number of dead accts or false shells running and include a count at the end. Does anyone know how to go about this? Thanks - citizencro (3 Replies)
Discussion started by: citizencro
3 Replies

5. Shell Programming and Scripting

Write a scripts to kill idle user for 60 min. & email user list to admin in text file

Folks, I have written one script for following condition by referring some of online post in this forum. Please correct it if I'm missing something in it. (OS: AIX 5.3) List the idle user. (I used whoidle command to list first 15 user and get username, idle time, pid and login time).... (4 Replies)
Discussion started by: sumit30
4 Replies

6. Shell Programming and Scripting

list all scripts in crontab which contains the string "sqlplus"

Hi folks I use a Solaris 10 box with Bash shell. I have here a script (it works!) to list all scripts in crontab which contains the string "sqlplus": for i in $(ls `crontab -l | grep -v '#' | awk '{ print $6 }' | grep -v '^$'`); do grep -l 'sqlplus' "$i"; done Is there a more elegant... (1 Reply)
Discussion started by: slashdotweenie
1 Replies

7. Shell Programming and Scripting

script to know the list of scripts in cron

Hi Can anyone please help me in knowing the list of scripts which are running in cron . I mean suppose there are users 1.A 2.B 3.C 4.D 5.E users on a pariticular server I need to have a script which will display all the scripts that are runnin in cron for all the above users ? is it... (1 Reply)
Discussion started by: mskalyani
1 Replies

8. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

9. UNIX for Dummies Questions & Answers

Profile scripts versus rc scripts....

what is the difference between login and profile scripts versus the rc scripts? (1 Reply)
Discussion started by: rookie22
1 Replies

10. UNIX for Dummies Questions & Answers

List of all PERL scripts.

Which command should I use to get the list of all the .pl scripts on the unix server... Thanks in advacne, Venky (3 Replies)
Discussion started by: venkyA
3 Replies
Login or Register to Ask a Question