第一個流程控制是 "if",學過程式語言的讀者,應該很熟悉,不需特殊說明, 讀者應可瞭解其用法,以下是各種格式:
 
 
if then
if command
then       
    then-commands 
fi                
if test condition
then       
    then-commands 
fi                
if [ condition ]
then       
    then-commands 
fi                
 
 
else

if [ condition ]
then       
    then-commands 
else           
    else-commands
fi
 
 
elif
			 
if [ condition1 ]
then        
    commands1 
elif [ condition2 ] 
then           
    commands2   
else         
    commands3
    commands3
fi

Web Page Copyright: 亞洲大學資訊電機學院 連耀南 yaonanlien@asia.edu.tw  ifcmd.htm,  Thu Sep 7 16:18:54 CST 2023