LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-03-2003, 12:51 PM   #1
GridX
LQ Newbie
 
Registered: Sep 2003
Location: Canada
Distribution: Fedora & Gentoo-uClinux
Posts: 15

Rep: Reputation: 0
Now I am stuck ... script help


Iwant to find a script to creat a pipeline that will generate a list of all script files in the "/bin" directory.

I think I need to use grep and sed but now sure how, can you guys help or give me any ideas?


GridX
 
Old 10-03-2003, 04:01 PM   #2
m0rl0ck
Member
 
Registered: Nov 2002
Distribution: A totally 133t distro :)
Posts: 358

Rep: Reputation: 31
How about:
grep -m1 -r "\/bin\/[bash||perl||sh]" /bin |grep -v Binary

Recurses -r, matches first line -m1, only matches /bin/bash /bin/sh or /bin/perl and greps "Binary" out of the output
 
Old 10-04-2003, 06:46 AM   #3
stv_t
Member
 
Registered: Oct 2003
Location: Gatwick, UK
Distribution: Mandrake 9.1, Mandrake 9.2, Redhat 9.0
Posts: 47

Rep: Reputation: 15
To catch any type of shell file how about
[B]grep -m1 -r '#!/' /bin |grep -v Binary[\B]
This will then catch 'awk', 'sed', 'ksh' and any other type of shell file
as the first line of all script files should start with [B]#![\B]
 
Old 10-04-2003, 06:48 AM   #4
stv_t
Member
 
Registered: Oct 2003
Location: Gatwick, UK
Distribution: Mandrake 9.1, Mandrake 9.2, Redhat 9.0
Posts: 47

Rep: Reputation: 15
Soo Sorry,
Ignore the [B] in the above post - should be:

To catch any type of shell file how about
grep -m1 -r '#!/' /bin |grep -v Binary
This will then catch 'awk', 'sed', 'ksh' and any other type of shell file
as the first line of all script files should start with '#!'
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
almost stuck puishor Linux - General 6 07-19-2005 05:04 PM
Need help....stuck yauser Linux - Laptop and Netbook 1 11-28-2004 06:14 AM
Stuck with C++! jeebas_13 Linux - Newbie 2 05-30-2004 09:36 AM
Stuck in X !! ewto Linux - Newbie 3 11-17-2003 02:00 PM
stuck clowns119 Linux - Software 5 09-24-2003 11:04 PM


All times are GMT -5. The time now is 01:58 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration