了解语法错误接近意外的令牌`newline'
我正在尝试关注 21181447”> 21181447>这个答案暗示运行此命令:
sudo bash -c "echo -n | openssl s_client -showcerts -connect $hostname:$port -servername $hostname \
2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
>> $trust_cert_file_location"
但是我得到了:
语法错误接近意外的令牌`newline'
,我发现这可能是因为>或>>命令中的操作员。我发现答案说是用引号逃避这些角色的答案,但是他们都谈论“>”字符是简单文本的一部分。当我的情况下是实际操作员时该怎么办?
I'm trying to follow this answer, which suggesting running this command:
sudo bash -c "echo -n | openssl s_client -showcerts -connect $hostname:$port -servername $hostname \
2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
>> $trust_cert_file_location"
But I'm getting:
syntax error near unexpected token `newline'
Now, I've figured out that it's probably because of either the > or >> operators in the command. I've found answers saying to escape such characters with quotes, but they all talk about cases when the '>' characters are a part of a simple text. What to do when it's an actual operator like in my case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您要在
\
之后应对一些白色空间。建议删除新的行分隔符:
建议测试您是否获得所有证书或第一个证书。
Assuming you are coping some white spaces after the
\
.Suggesting to remove the new line separator:
Suggesting to test if you get all certificates or just the first one.