Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

continuing towards writing more complex and usable scripts

Posted on 2004-09-26
5
Medium Priority
?
271 Views
Last Modified: 2013-12-26
I've started writing shell scripts just one or two months ago...so basically i'm very new to it.
Now the question that i want to ask...how can i go for writing scripts that can perform operation of basic utility programs, i.e, whether one can write a script whose output are like that of ls, wc, grep etc commands.

Plz guide me...
0
Comment
Question by:abhishek_2707
5 Comments
 
LVL 11

Expert Comment

by:avizit
ID: 12154307
i think ls, wc , grep etc are  c programs ,
you can "use" those commans in your shell scripts ..

to write programs like wc , you should be doing coding in a high level language like c, c++

on the other hand you can also move forward by writing scripts and thereby automating your daily work

as forme .. nowadays I try to avoid coding in high level languages , by doing my work in perl etc ..
0
 
LVL 11

Expert Comment

by:avizit
ID: 12154313
0
 
LVL 9

Expert Comment

by:HamdyHassan
ID: 12155156
My advice to you, continue your learning by start Perl scripting, you will find a lot to learn , lot of fun
0
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 12155737
The whole philosophy of Unix programming is:
"many small, very specialized programs, that can be assembled into solutions."
and shell scripts are the glue that is used to assemble the components.
So the shell languages are designed to run the ls, wc etc commands and use
grep, awk, cut, sed, etc to parse the outputs.


0
 
LVL 16

Accepted Solution

by:
manav_mathur earned 150 total points
ID: 12197834
Continuing on brettmjohnson's concept,
almost everything that you will come across in UNIX is a file. Even the devices attached to your system can be considered to be files.

Normally, in shell scripting, what remains is file manipulation. UNIX provides many built in utilities lile ls, wc etc. for that which are precompiled C binaries(read executable files). You can find them all in the /dev/bin directory. (for that matter, in UNIX even a directory is a file!!) These binaries perform small independent tasks.

The existing binaries have been optimally designed and normally you dont try to 'reprogram' them or use your own code. They offer plenty of options in the form of commandline arguments/switches.

man <command>

will give you a complete listing of all the arguments that the command accept and usually that is more than enough for even the most complex scripts.
It is a matter of combining the funcitoanlity of the available commands in a shel script for your purpose.

For advanced text manipulation, learn PERL. It proves very sueful in the long run as Im realizing now :)

Cheers
Manav
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question