【发布时间】:2021-08-23 12:43:48
【问题描述】:
假设我有一个 shell 脚本,这是它的内容:
#!/bin/bash
echo "/bin/bash -p" && echo "Pretty Power of zeus Pouring down thunder"
例如,当我 grep 时:cat test.sh | grep 'p' 它将仅返回 -p 中的 /bin/bash -p。
这是为什么呢?我假设是因为这是p 发生的第一个实例,但并不完全确定。
【问题讨论】:
-
在代码周围使用这个```和这个```,寻找“行结尾”的正则表达式
-
test.sh 只包含一个
p。