桑达 - 未知选项,以单曲“ [英] Sed - unknown option to `s'

查看:120
本文介绍了桑达 - 未知选项,以单曲“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用

  SED -i -eS /.* SEB。* / \\$ ftp_login_template \\/$ ftp_dir

不过,我得到这个错误

 的sed:-e前pression#1,烧焦34:未知的选项'S'

我不明白为什么,因为这完美的作品

  SED -i -eS /.* wbspassword * / \\。wbspassword \\:\\$密码\\/$ user_conf

任何想法,我做错了吗?
难道这是问题吗?

<$p$p><$c$c>ftp_login_template=\\${user}:${password}:24:86::\\/var\\/lib\\/clit.${user}\\/downloads:\\/bin\\/false\\\"


解决方案

问题是用斜杠:您的变量包含他们最后的命令会像 SED的/字符串/路径/到/事/ G',包含太多的斜杠。

由于 SED 可以采取任何字符作为分隔符,你可以尝试用另外一个来代替 /

 的sed -e的@表达式1 @ @表达式2

I'm trying to use

sed -i -e "s/.*seb.*/    \"$ftp_login_template\"/" $ftp_dir

however I get this error

sed: -e expression #1, char 34: unknown option to `s'

I don't understand why since this works perfectly

sed -i -e "s/.*wbspassword.*/    \"wbspassword\": \"$password\",/" $user_conf

Any ideas as to what I'm doing wrong? Could this be the problem?

ftp_login_template=\${user}:${password}:24:86::\/var\/lib\/clit.${user}\/downloads:\/bin\/false\"

解决方案

The problem is with slashes: your variable contains them and the final command will be something like sed 's/string/path/to/something/g', containing way too many slashes.

Since sed can take any char as delimiter, you can try using another one instead of /:

sed -e 's@expr1@expr2@'

这篇关于桑达 - 未知选项,以单曲“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆