📜  bash 字符串以 - Shell-Bash 代码示例开头

📅  最后修改于: 2022-03-11 14:50:48.237000             🧑  作者: Mango

代码示例1
[[ $a == z* ]]   # True if $a starts with a "z" (wildcard matching).
[[ $a == "z*" ]] # True if $a is equal to z* (literal matching).

if [[ "$HOST" =~ ^user.* ]]; then
    echo "yes"
fi

if [[ "$HOST" =~ ^user.*|^host1 ]]; then
    echo "yes"
fi