1、本地变量:set variable_name = value
全局变量:setenv VARIABLE_NAME value
2、The special variable $< reads a line of input from the user and assigns it to a variable.
EXAMPLE
echo "What is your name?"
set name = $<
3、set names = ( Tom Dick Harry Fred )
shift names
4、@ n=5+5
echo $n
5、if ( expression ) then
block of statements
else if ( expression ) then
block of statements
else if ( expression ) then
block of statements
else
block of statements
endif
6、echo $argv[1] $argv[2] $argv[3]
echo $argv[*] all the arguments
echo $#argv the number of arguments
7、switch ( "$color" )
case blue:
echo $color is blue
breaksw
case green:
echo $color is green
breaksw
case red:
case orange:
echo $color is red or orange
breaksw
default:
echo "Not a valid color"
endsw
8、
The loop control commands are break and continue.
EXAMPLE
while ( expression )
block of statements
end
foreach variable ( word list )
block of statements
end
------------------------------
foreach color (red green blue)
echo $color
end
10、-r Current user can read the file
-w Current user can write to the file
-x Current user can execute the file
-e File exists
-o Current user owns the file
-z File is zero length
-d File is a directory
-f File is a plain file
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/20542911/viewspace-615778/ ,如需转载,请注明出处,否则将追究法律责任。