Open main menu

CDOT Wiki β

Automation of Routine Tasks (Shell Scripting)

Revision as of 10:50, 27 January 2010 by Msaul (talk | contribs)

Definition of Shell Scripting

The term "Shell Scripting" refers to Linux or Unix operating system commands placed in a file to be executed in a sequence. This frees the user or administrator from issuing the same commands manually from the shell prompt.

Here is the Wikipedia Definition of a Shell script: http://en.wikipedia.org/wiki/Shell_script

Background Information

It is very common for people that are taking computer programming courses for the first time to ask, "Why are you teaching operating system commands? Didn't that die-out with MS-DOS?" The answer to that question depends on how the person is going to use the computer system....

For example, people that just use computers to perform simple tasks, probabaly will NOT use operating system commands. Those people are just using the computer at the graphical (high-end). This is why they are referred to by IT (Information Technology) staff as "end-users". On the other hand, there may be users that are just curious, or employed to administer or help to "automate" certain routine tasks. These individuals need to learn programming languages or operating system commands to create shell scripts in order to provide that "automation".

Since these individuals tend to work "behind-the-scenes", many opt to use simple text-based tools which give them the flexibility and efficiency to concentrate on the task at hand.

Graphical Shell or Text Based Shell Scripting

There is an on-going debate regarding Graphical versus Text-based in programming for many years. This author remembers people mentioning about "Graphical Shells", but these approaches never seem to go "mainstream".

Programmers have more flexibility with tools to help them program. Many programmers use Visual tools to help produce code (these tools or applications are called "front-ends") which provide graphics to make it easier for the user to construct code (which is done by the application or tool "behind the scenes" (the backend).

Shell scripting can use commands such as Zenity that provide graphical tools (dialog boxes) in order to obtain input, display output, select files, display progress of an activity, etc...

Here are some links to Youtube videos I have used to demonstrate how I expect my students' assignment (shell script) to run to automate a routine task (create a simple webpage)

[ Youtube Video1 ] [ Youtube Vedeo2 ]

FYI: Used "recordmydesktop" application in Linux to record, then posted video to Youtube...

Here is a basic tutorial on Zenity command to help my students with an assignment:

[ Zenity Tutorial ]

Resources

Here are some resources to shell scripting:

Seneca College (OPS435 shell scripting course) - Requires Seneca Student account access:

http://murraysaul.wordpress.com/ops435/

Seneca College (SPR720 shell scripting course) - Older course content, but open to public:

https://cs.senecac.on.ca/~murray.saul/SPR720/notes.html