if [ test_command ]
then
commands
fi
if [ test_command ]
then
commands
else
commands
fi
commands
elif [ test_command ]
then
commands
...
...
else (optional)
commands
fi
commands
done
commands
done
commands
done
commands_to_execute_for_1 ;;match_2)
commands_to_execute_for_2 ;;match_3)
commands_to_execute_for_3 ;;
...
...
*) (可選 - any other value)
commands_to_execute_for_no_match
;;
esac