Information AboutC Shell |
| CATEGORIES ABOUT C SHELL | |
| curly bracket programming languages | |
| domain-specific programming languages | |
| text-oriented programming languages | |
| scripting languages | |
| unix shells | |
| unix software | |
|
FEATURES The C shell has the typical Unix shell structure: each line of input (or line of a script file) is interpreted as a separate command to execute, with Backslash es "escaping" newlines where needed (so that multiple input lines can comprise a single command to be executed. New features These features were first introduced in C shell, though most are now common to many Unix and Unix-like shells. ;Job control :The ability to suspend an interactive job and resume it at a later time, or send it into the "background". ;History substitution :The !-substitution feature allowed previous commands to be re-executed or edited in a variety of ways.;Arrays :Variables could contain multiple elements, which could be numerically indexed. ; ~ expansion :Home directory by username lookup, usng ~ was popular enough that most modern, Unix-based Web Server s now support it, in addition to most shells.;Aliases :A command could be aliased to another command or command sequence. ;Math operations :Provided Arithmetic al operations which sh does not provide except by calling external programs. Syntax differences The most obvious difference between C shell and Bourne shell syntax was the use of parentheses for built-in conditional operations that Borne shell called out to test for using square brackets (later versions of Bourne shell would rectify this by using a built-in test operator). Variable assignment was also performed slightly differently with " set a = b" rather than Bourne shell's "a=b".CRITICISM While the C shell introduced many innovative features in interactive mode, the C shell's scripting capabilities came under criticism in the early-to-mid 1990s for their ambiguity, especially with respect to quoting and redirection. Combined with the fact that Bourne shell is guaranteed to be present on all Single UNIX Specification -compliant systems, sh is usually used for scripting purposes over C shell on Unix. An example of possibly unwelcome behaviour of csh scripts is the following: if ( ! -e foo ) echo bar > foo It would appear to say "if file 'foo' does not exist, create it with contents 'bar'". But it will in fact create an empty file, as the line is parsed such that the output redirect is set up before the file existence is tested. (These and other criticisms do not, however, apply to the more-modern Hamilton C shell variant of the csh language.) If scripts are written in csh, it is often useful to run the script with the -f flag, (e.g. by starting with the line #!/bin/csh -f) in order to avoid running the user's setup file as this may affect the script's behaviour. EXTERNAL LINKS
|
|
|