LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What is the use of shell programming? (https://www.linuxquestions.org/questions/linux-newbie-8/what-is-the-use-of-shell-programming-438556/)

gregorian 04-25-2006 02:12 AM

What is the use of shell programming?
 
I know Java and Dos batch programming.:cool:

Dos batch programming is not of much use unless you are the kind of guy who loves writing batch viruses.

I heard Shell programming is the Unix equivalent of Batch for Windows.

I want to know its capabilities and its use and its essentialness(if such a word exists) for a Linux Users.

I googled for Shell programming but only found lists of Unix commands.Any help will be appreciated.:)

masand 04-25-2006 02:42 AM

Just google for

"Why shell programming?"

satinet 04-25-2006 02:46 AM

Quote:

I heard Shell programming is the Unix equivalent of Batch for Windows
This is kind of true. However, the unix shell is far more powerful and flexible. Indeed many important parts of the unix/linux system operate through shell scripts. e.g. rc scripts.

A point to note that this is usually called "shell scripting" rather than shell programming, so maybe that's why your search results weren't too great.

take a look at this:

http://www.tldp.org/LDP/abs/html/why-shell.html

Shell scripting is very powerful. but like most langauges it has it's good and bad points. And things it is good for doing, and things it is not good for doing.

I would recommend the O'Reilly book "Classic Shell Scripting" if you are intersting in learning more.

This is very important if you want to learn about linux!

cs-cam 04-25-2006 02:52 AM

Wow, so many answers. I use shell scripts to make tasks easier. There is a monster amount of CLI apps available for linux so you can do almost anything you want, example, rather than have to open a FTP client, find directories etc and upload a file to my site, I have a small shell script with my password encrypted in a file and it uses a CLI ftp app to upload a file I specify.

Random example but you can write scripts to make complicated tasks one-liners.

zeitounator 04-25-2006 02:53 AM

Quote:

Originally Posted by gregorian
Dos batch programming is not of much use unless you are the kind of guy who loves writing batch viruses.

This makes as much sense as saying "Microsoft office is not of much use unless you are the kind of guy who loves to write macro viruses" or even "a hammer is not of much use unless you are the kind of guy who loves to hit his fingers hard". Batch programming is very usefull, in dos, winxp shell or linux to automate repetitive tasks, fire automatic actions upon login or startup, make simple installers, write simple programs....

Quote:

Originally Posted by gregorian
I heard Shell programming is the Unix equivalent of Batch for Windows.

I want to know its capabilities and its use and its essentialness(if such a word exists) for a Linux Users.

I googled for Shell programming but only found lists of Unix commands.Any help will be appreciated.:)

Have a look at this guide for bash shell:
- http://www.tldp.org/LDP/Bash-Beginne...tml/index.html
- http://www.tldp.org/LDP/abs/abs-guide.pdf

gregorian 04-25-2006 05:34 AM

Thanks for the replies.I guess it answers all of my questions and now I'm gonna learn shell scripting.:)

halturata 04-25-2006 05:39 AM

Well, shell scripting is most usefull when you want to automate a particular sequence of commands you would otherwise have to type one by one on the prompt.As an example a lot of your Linux box startup is performed with shell scripts, i.e. loading of modules mounting of filesystems, starting of processes, etc. Shell scripting is also used in some programming environments to assign specific environment variables which are then used as a reference by compiling or running a program. And these are only some of the possible appliances of scripting.
As satinet mentioned above, it is very important to understand and to be able to write shell scripts if you want to learn the depths of Linux.
So I advise you to take a look at the manuals on www.tldp.org

Good Luck! :)

mjjzf 04-25-2006 06:02 AM

It is mostly useful if you service many PCs or a server - to simplify recurring tasks. A good place to learn is Linux Command.


All times are GMT -5. The time now is 06:54 PM.