标签: bash switch-statement
如何将字符串的后缀与case语句匹配?
实施例
case "foobar" in "*bar") echo "yay!" ;; esac
答案 0 :(得分:4)
如果你丢失报价,效果会很好;
#!/bin/bash case "foobar" in *bar) echo "yay!" ;; esac