case命令用于处理一连串的匹配需求
语法格式:
case variable in pattern1 | pattern2) commands1;; pattern3) commands2;; *) default commands;; esac
举例:
#!/bin/bash case $USER in root | tom) echo "welcome $USER";; *) echo "hi $USER";; esac