1 Introduction

Scripting is a powerful and time-saving tool for performing repetitive jobs, creating data-processing pipelines, and encapsulating useful recipes. A script is a text file containing a set of shell commands and constructs that perform a routine task. The former can include UNIX commands like mv, cd, awk, sed; other scripts; and private and Starlink applications. You can create and modify scripts with a text editor.

Although UNIX purists recommend the Bourne or bash shell for scripts and indeed some consider C-shell programming harmful, many scientists who are occasional programmers find the familiar C-like syntax more approachable and easier to learn for scripting. Whereas young Turks would advocate the increasingly popular perl and Python languages, a 1996 survey of Starlink users placed C-shell scripting near the head of required cookbooks. In addition most Starlink commands are available as C-shell aliases. This cookbook applies to both the C-shell csh and its variants like the tc-shell tcsh.

This manual illustrates some relevant techniques for creating C-shell scripts that combine Starlink software to improve your productivity, without you having to read a UNIX manual. It aims to give practical and reassuring examples to at least get you started. It does not offer a comprehensive description of C-shell syntax and facilities.

This is not like other cookbooks in the Starlink series as the possible recipes are limitless. Instead of concentrating on recipes, it therefore focuses on the various ingredients you may need for your own creations. Thus it has a tutorial style more akin to a guide. However, it has been structured with the aim of letting you dip in to find the desired ingredient.

The author welcomes your comments. If you have “How do I do …in the C-shell” type questions, or suggestions for further recipes and ingredients, please contact the Starlink Software Librarian (starlink@jiscmail.ac.uk) or the author (mjc@star.rl.ac.uk), so that important techniques omitted from this version may be included in future editions.