Solved

continuing towards writing more complex and usable scripts

Posted on 2004-09-26
5
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 50 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 59
WinWaitActive parameters 12 31
tripleUp challenge 7 97
how to use laptop or pad camera in vb.net windows application 2 131
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

751 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