SHELL控制语句的语法
 
 
  • if判断语句
 
Bourne and Korn Shell
 
if command
then
 commands
elif command
commands
else
commands
fi
 
 
C Shell
 
if (cond) then
commands
else if (cond) then
commands
else
commands
endif
  
 
  • while 循环
Bourne and Korn Shell
while command
do
commands
done
 
 
C Shell
while (cond)
commands
end
 
 
  •  for /foreach 循环
Bourne and Korn Shell
for variable in list
do
commands
done
 
C Shell
foreach variable(list)
commands
end