Could someone please explain a little about what shell is,what is use of scripting.
Are these used in commercial applications?
Are they like c or require languages like perl?
The Linux shell has it’s own language, and programs in it are called shell scripts.
When you run something at a terminal, you are actually executing one statement at a time, you are typing the program into the shell running in the terminal session.
The shell language is mainly used to write scripts that make use of existing commands.
Here’s a tutorial on bash, the shell that is most commonly used in Linux, from the online Linux documentation:
Shell is a language on its own, it does not use external languages like perl or python. If offers a lot of the things others offer, like ‘if’, ‘case’ and ‘select’ conditionals, until, while and for loops, functions, integer arithmetic, arrays, global and local variables, etc
It is mostly used to automate things by often building a chain of commands using pipes. It can also be used for heavier stuff, like I use Bash to write my h264enc shell program which is a front-end to mencoder
In real applications (those written in C, C++, etc) shell scripting is mostly used to kick-start the building process like the ‘configure’ script does
I’m also a beginner but I read Bash Guide for Beginners from The Linux Documentation Project: Guides and I think it’s a very good introduction!
Nice thoughts offered so far. I though I add my 2 bits’ worth.
I started scripting recently. The way it was explained to me was as follows.
Think of an operating system as a fruit or a nut. The functionality of the OS is provided by its core, called the KERNEL. The kernel itself has no visual user interface. That user interface is provided by the outer part of the fruit or nut, called the SHELL. You must go through the shell to reach the kernel.
Programming languages such as C, C++, Java, Cobol provide functions that a programmer calls to communicate with the operating system. These languages have power, but they require significant programming effort.
For a user, who does not want to program extensively, shells of most operating systems provide prepackaged functionality or prepackaged conveniences via SHELL COMMANDS. A user can use these shell commands individually and interactively (such as to list files in a folder - the lf command) or put a bunch of shell commands into what is known as SHELL SCRIPT, to create customized functionality (such as to automatically insert copyright notice in all of your web pages at once).
Most operating systems provide shell commands and a SHELL (an environment to enter and execute shell commands and shell scripts).
There is a slight difference between a shell scripting language and a scripting language (you can imagine what that is - just from the names), but that difference is rather marginal. Languages such as perl, php, biterscripting, vbscript provide operating system functionality as well as other needed prepackaged conveniences/functionalities.
I used the tutorials posted at http://www.biterscripting.com/LearningScripting/overview.html . They were tremendously helpful in getting me quickly up to speed with scripting.
The two things I think are crucial in making oneself proficient in shell scripting -
- Start with a structured approach to learning scripting, such as the tutorials above, or a book.
- Experiment with commands and scripts. Most commands and scripts will NOT work the first time for you. Try different options, arguments, using double quotes, no double quotes, etc. until they work.
So, there may be a bit of a learning curve (I would say about a week), but once you go past it, the power of shell scripting is yours to keep. Plus, shell scripting looks very, very good on ones resume.
J
Thanks a lot.
This was exactly what i was looking for.
Hope to add shell scripting to my resume very soon.