Bourne:如何在变量中保存字符串?
我正在尝试在 Bourne 中执行以下行:
LIST="-foo, -bar, baz"
但是,我收到错误:
-bar: command not found
任何人都可以帮我解决这个问题吗?谢谢!
I'm trying to execute the following line in Bourne:
LIST="-foo, -bar, baz"
However, I am getting an error:
-bar: command not found
Can anyone help me figure this out? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果字符串实际上没有被引用,就会发生这种情况。
您有可能正在执行
LIST=$somevariable
而不是您在问题中所写的内容吗?因为那样你应该写LIST="$somevariable"
。This happens if the string is in fact not quoted.
Any chance you are doing
LIST=$somevariable
instead of what you wrote in the question? Because then you should writeLIST="$somevariable"
instead.