































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
































#this script consults an on-line telephone database grep -i $1 $HOME/phonenumbers
A comment A positional parameter An environment variable
foreach var ( wordlist ) commandlist end
#!/bin/csh
foreach x ( * )
echo Changing mode for $x chmod +rx $x
end
##check and set parameters
if ( $#argv > 2 || $#argv < 1 ) then
echo usage: “$0 [ from-file ] to-file” exit(1);
else
if ( $#argv == 2 ) then set from = $argv[1] set to = $argv[2] else set to = $argv[1] endif
endir
switch ( str ) case pattern1 : commandlist breaksw case pattern2 : commandlist breaksw … default: commandlist endsw
while ( expr ) commandlist end
set i = $#argv while ($i) echo $argv[$i] @ i-- end
@ var = expr @ var[n] = expr
@ x = $#argv/ @ argv[$j] = $j + 4 @ x += 3 @ i++
logical expression by enclosing the command in braces ({ and }): if ({ command1 } && { command2 } || { command3 } then