ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i want to learn shell scripting...so what are prerequisites for shell scripting...where should i begin from..suggest good reading..
in what language it is done...i heard it cannot be done in C- is that true
The shell has its own language. The shell source code is in C, but you have nothing to do with C while programming in shell, except for some similar syntax.
i want to learn shell scripting...so what are prerequisites for shell scripting...where should i begin from..suggest good reading..
in what language it is done...i heard it cannot be done in C- is that true
Is there a real need for you to know shell scripting ?
Shell scripts are considered to be difficult to maintain, and shell language is limited compared to more moder advanced scripting languages.
Even though I work with UNIX-like systems since 1991, I haven't found a compelling reason to learn shell deeply, though I know the basics and simple everyday things, but nothing fancy.
Some things are easier in the shell (interacting with files, the filesystem and system processes), while others are easier in Perl (working with databases, anything that needs more than integer arithmetic and rudimentary data structures). I use both, though I came first to shell scripting.
I started off mainly by Googling for stuff as I needed it, but there is good material out there. Try The Rute User's Guide (a bit old, but still good) or the Linux Documentation Project's Advanced Bash Scripting Guide (it does start at the beginning, honest!) for starters.
if you want my idea
try Tcl
it can make GUI and same functionality of shell scripting and more easier\
at the end it is back to u
Neither TCL, nor shell are compilable, so you catch your errors only after
interpreter arrives to them during execution, if at all. I.e. a corner case may be caught years after creation.
Perl/Python/Ruby and the like are first compiled into at least parse tree.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
As said many times, use the tools best suited for the purpose. If it comes to starting and stopping other processes, file handling etc. use shell scripting.
If shell scripting is so bad, why almost all of the init.d files are written in shell script?
I don't know Perl, so that precludes any preference for Perl. But I do know TCL quite well, and there are a lot of situations where I prefer shell over TCL for various reasons. And the other way around.
As said many times, use the tools best suited for the purpose. If it comes to starting and stopping other processes, file handling etc. use shell scripting.
If shell scripting is so bad, why almost all of the init.d files are written in shell script?
I don't know Perl, so that precludes any preference for Perl. But I do know TCL quite well, and there are a lot of situations where I prefer shell over TCL for various reasons. And the other way around.
jlinkels
"Bad" is a relative term. Shell interpreter occupies less memory than Perl one, for example.
But nowadays memory consumption is less of a concern, and with the existence of persistent Perl startup times can be minimized. And with caching it's small anyway.
In the end, it's a matter of habit. If I am ever to have a need to deal with startup scripts seriously, I'll do this in Perl.
FWIW, there are even Perl interactive shells around.
Certain tasks are easier in certain languages than they are in others. You can perform almost any systems admin task in Perl, just as you could use a chef's knife to chop vegetables, dig a hole or perform an emergency tracheostomy. Doesn't mean that it would be as neat and easy for each. Trowels and scalpels have their place. So does shell scripting.
each shell is a language.
like DOS is a language (.bat files)
csh
sh
bash
ksh
are all languages.
don't bother with csh, learn bash.
bash, sh and ksh are all similar.
all unix systems' init scripts are shell scripts, so it is important to learn.
I think the terms Bourne-shell compatible and Bourn-again-shell compatible are more correct than saying they are similar. ksh may be an enhanced bash, but it is still Bourn-again-shell compatible, and that's what's important. If you write a bash-compatible script it will work on both ksh and bash and others. If you write an sh-compatible script it should work on bash and ksh too. But bash may not work using sh, but then no one uses sh anymore AFAIK.
hello,
However, perl arrays works too slow than awk. Shells scripting may to begin learn from run scripts /etc/init.d, but what's you goal? Just do what your needs.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.