C Shell Scripting

What is C shell?

C shell is a Unix shell created in 1979 by Bill Joy soon after the Bourne shell was released in 1977. Although the latter went on to be the standard shell for Unix, C shell is still popular in BSD distributions. C shell's scripting syntax is modeled after the C language in some aspects. Small programs can be created by writing scripts using the C shell syntax.

The Bourne shell is also an option to create Unix scripts but if you are reading this book you probably decided the C shell fits your requirements better. Deciding to use a Unix script at all means that the requirements of the program are rather simple, such as automating the usage of either standard or custom Unix tools. Complex logic or speed sensitive functions should be written in a more appropriate language as custom tools.

Nowadays, tcsh, a compatible descendant of C shell, is more commonly used. This book will cover both versions.

Setup and Installation

Learning the Language

Illustration of a literal sea shell.
Illustration of a literal sea shell.

Basics

This section is about learning basic C shell to create small useful scripts. Useful for programmers of any level.

Syntax 25% developed

  • Comparison with Bourne shell
  • Use of variables in the shell
  • Arithmetic variables
  • Expressions and true and false
  • Boolean conditions
  • Built-in variables
  • Array variables
  • Switch statements

Cookbook

Snippets 25% developed

Example scripts

Resources

Wikibook Development Stages
Sparse text 0% Developing text 25% Maturing text 50% Developed text 75% Comprehensive text 100%
Category:Book:C Shell Scripting#%20 Category:Subject:Scripting languages#C%20Shell%20Scripting Category:Subject:Scripting languages/all books Category:Subject:Computer programming languages/all books Category:Subject:Computer programming/all books Category:Subject:Computer science/all books Category:Subject:Computing/all books Category:Subject:Books by subject/all books Category:Subject:Computing/all books Category:Subject:Books by subject/all books Category:Book:C Shell Scripting#%20 Category:Book:Wikibooks Stacks/Books#C%20Shell%20ScriptingCategory:Shelf:Scripting languages Category:Shelf:Scripting languages/all books Category:Shelf:Computer programming/all books#Computer%20programming Category:Shelf:Computer programming languages/all books#Computer%20programming%20languages Category:Shelf:Computer science/all books#Computer%20science Category:Department:Computing/all books#Computing Category:Alphabetical/C Category:Partly developed booksCategory:Books by completion status/all books
Category:Alphabetical/C Category:Book:C Shell Scripting Category:Book:Wikibooks Stacks/Books Category:Books by completion status/all books Category:Department:Computing/all books Category:Partly developed books Category:Shelf:Computer programming/all books Category:Shelf:Computer programming languages/all books Category:Shelf:Computer science/all books Category:Shelf:Scripting languages Category:Shelf:Scripting languages/all books Category:Subject:Books by subject/all books Category:Subject:Computer programming/all books Category:Subject:Computer programming languages/all books Category:Subject:Computer science/all books Category:Subject:Computing/all books Category:Subject:Scripting languages Category:Subject:Scripting languages/all books