📌  相关文章
📜  bash 检查字符串是否包含子字符串 - Shell-Bash 代码示例

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

代码示例4
#!/bin/bash

STR='GNU/Linux is an operating system'
SUB='Linux'

if grep -q "$SUB" <<< "$STR"; then
  echo "It's there"
fi