Linux Scripting

under construction!

Scripting in linux is far too complex to describe in detail here, but it may be useful to present a very brief over-view of some of the ideas involved in it. The basic idea behind a script is that if you need to perform the same series of actions more than once, you can write a script that repeats those actions whenever you need them.

One use of scripting would be to combine all the actions needed to complete a project or an analysis into a single shell script. If this is done properly, the work can be repeated exactly whenever needed, and at least in principle, all output can be deleted since it can easily be regenerated. For example, if you were working on an icosahedral virus reconstruction where every single step could be performed in a way that involved no interactive user input, it would be possible to write a shell script that starts with the raw image data and ends with a high resolution three-dimensional reconstruction. This isn't usually practical, but it is also not as crazy an idea as it might appear at first.

A more useful way to think about scripting is that if you perform any sort of even slightly complicated but identical actions on the same type of input data, you will save yourself time by writing a script to do this. The script can be somewhat flexible in that it can take into account that certain parameters may need to change whenever the actions is performed (in which case, the script would accept command line options similar to those seen with standard linux commands).

All scripts are built around a series of commands that a user could execute from the command line of a terminal window. Whereas a user might know things that would help accomplish the given task, the script must either be explicity told these things (the options mentioned in the previous paragraph) or it must be capable of figuring things out on its own. It may also be helpful for the script to document what it is doing or has done, to eliminate any intermediate files that are not useful and to inform the user when unexpected things happen while the script is running. All these things are accomplished using a fairly limited but powerful set of commands.