问题:
I have "I love Suzi and Marry" and I want to change "Suzi" to "Sara". 我有“我爱Suzi和结婚”,我想将“ Suzi”更改为“ Sara”。
#!/bin/bash
firstString="I love Suzi and Marry"
secondString="Sara"
# do something...
The result must be like this: 结果必须是这样的:
firstString="I love Sara and Marry"
解决方案:
参考一: https://stackoom.com/question/tQki/将一个子字符串替换为Shell脚本中的另一个字符串参考二: https://oldbug.net/q/tQki/Replace-one-substring-for-another-string-in-shell-script
来源:oschina
链接:https://my.oschina.net/u/4428122/blog/4338463