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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-30-2005, 11:42 PM
|
#1
|
|
LQ Newbie
Registered: Aug 2005
Location: New York
Posts: 12
Rep:
|
read scripts
Someone mentioned to me about making shell scripts and I wanted to read the ones on my distro (RH9).
As i attempt to shed some newbie skin i fin i'm typing find / -name ____ often and i'd like to write a script to speed up my learning while indulging my slackard ways.
Thanks
|
|
|
|
08-31-2005, 05:45 AM
|
#2
|
|
Senior Member
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware 14.0
Posts: 1,476
Rep:
|
I think it would be easier to set an alias for this task (man alias). For writing bash scripts look at http://www.tldp.org/guides.html -- there is a guide called "Bash Guide for Beginners".
|
|
|
|
08-31-2005, 10:41 AM
|
#3
|
|
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
|
Other suggestions for reading system shell scripts.
A really laudable endeavor reading the system shell scripts.
Some other suggestions: - locate
- Cruise /etc -- I like to use mc (Midnight Commander) for that:
- For a list of shell scripts in /etc:
Code:
# grep -RE '^#![[:space:]]*/bin/(ba)?sh' /etc/* \
|awk -F: '{print $1}'|less -S#20
- To view them all in succession:
Code:
# less `grep -RE '^#![[:space:]]*/bin/(ba)?sh' /etc/* \
|awk -F: '{print $1}'`
Notes- The '#' is to remind you to run these as root -- fewer errors & more access
- Ignore all ":grep: ... No such file or directory" lines, they are going to stderr
- RTfM on the things you don't understand here, it's a good opportunity to learn. less, grep, & awk are very useful tools, & I have deliberately not explained the options I used. (More chance for you to learn.
)
- Keep a good bash reference handy as you read the scripts.
- If you want to look at other directories, change '/etc/*'.
- EDIT: Broke long "Code" lines w/ '\\' to minimize horizontal scrolling. Be sure to re-assemble properly.
Last edited by archtoad6; 08-31-2005 at 10:46 AM.
|
|
|
|
08-31-2005, 11:22 AM
|
#4
|
|
LQ Newbie
Registered: Aug 2005
Location: New York
Posts: 12
Original Poster
Rep:
|
archtoad6,
thanks! i wont be able to try until later....
i tried to locate the script run from the 'more' command by using find / -name more, hoping this would lead me to the actual script and when i tried to open the 'script' with vi, as determined by the results of find, i got junk printed.
i guess the commands you posted somehow make the scripts into human language as opposed to the machine language these files are in.
|
|
|
|
08-31-2005, 11:42 AM
|
#5
|
|
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
|
Scripts by definition are text files. You probably have been trying to look at binaries too.
BTW, after you are done w/ /etc/*, consider /bin/* & /sbin/*; they are mostly binaries, but there are a few scripts.
BTW2, the extension '.sh' is supposed to indicate a shell script, but is not mandatory. In *nix, file extensions are advisory only.
|
|
|
|
| Thread Tools |
Search 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
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:19 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|