C-Shell Scripting (Cheat Sheet) Comments # one line comment
Variables # declaration set variable # initialization set variable = value # print variable's value echo $variable
Arrays # initialization set array = (value1 value2 .. valuen) # print item's value echo $array[index]
If Statement if (expression1) commands else if (expression2) commands else commands endif
GoTo Statement goto label commands label: commands
Repeat Statement repeat number command
Foreach Statement foreach array (variable) commands end
Switch Statement switch (expression) case pattern1: commands breaksw case pattern2: commands breaksw default: commands endsw
While Statement while (expression) commands end
Hello Word Script #/bin/csh $echo “hello world!”