Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
线
echo xxx | sed "s/xxx/a""b/"
输出
ab
而不是
a"b
正如预期的那样。
解决方法是什么?
使用以下命令:$
echo xxx | sed s/xxx/a\"\"b/
输出将是:a""b
请注意 ("(quote) 应该被转义,所以我们需要这样做两次,这就是这里的技巧)