Linux Today: Linux News On Internet Time.

More on LinuxToday Shell Programming

Sep 30, 2001, 21:45 (9 Talkback[s])
(Other stories by Guido Socher)

WEBINAR: On-demand webcast

How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >

"Even though there are various graphical interfaces available for Linux the shell still is a very neat tool. The shell is not just a collection of commands but a really good programming language.You can automate a lot of tasks with it, the shell is very good for system administration tasks, you can very quickly try out if your ideas work which makes it very useful for simple prototyping and it is very useful for small utilities that perform some relatively simple tasks where efficiency is less important than ease of configuration, maintenance and portability. So let's see now how it works:

There are a lot of different shells available for Linux but usually the bash (bourne again shell) is used for shell programming as it is available for free and is easy to use. So all the scripts we will write in this article use the bash (but will most of the time also run with its older sister, the bourne shell). For writing our shell programs we use any kind of text editor, e.g. nedit, kedit, emacs, with other programming languages. The program must start with the following line (it must be the first line in the file):

The #! characters tell the system that the first argument that follows on the line is the program to be used to execute this file. In this case /bin/sh is shell we use. When you have written your script and saved it you have to make it executable to be able to use it. To make a script executable type chmod +x filename Then you can start your script by typing: ./filename"

Complete Story

Related Stories: