bash中sed unterminated s命令出错 [英] Error with sed unterminated s command in bash
本文介绍了bash中sed unterminated s命令出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在bash脚本中使用sed时遇到问题. 这是一行:
I'm having a problem with using sed in a bash script. Here is the line:
sed -i "s/"$name"/"$input"/g" ~/input.script
我收到此错误: sed:-e表达式#1,字符24:未终止的s命令
I'm getting this error: sed: -e expression #1, char 24: unterminated `s' command
很奇怪,它正在我的代码的早期版本中工作.我一直在拍摄时遇到麻烦,但是找不到解决方法.
Weirdly enough it was working in an earlier version of my code. I've been trouble shooting but I cannot find a solution.
推荐答案
您不需要嵌套的引号.另外,尝试更改分度符:
You don't need nested quotes. Also, try changing the delimeter:
sed -i "s@$name@$input@g" ~/input.script
这篇关于bash中sed unterminated s命令出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文