开发者

Bourne: How to preserve a string in a variable?

开发者 https://www.devze.com 2023-01-08 00:57 出处:网络
I\'m trying to execute the following line in Bourne: LIST=\"-foo, -bar, baz\" However, I am getting an error:

I'm trying to execute the following line in Bourne:

LIST="-foo, -bar, baz"

However, I am getting an error:

-bar: c开发者_JAVA技巧ommand not found

Can anyone help me figure this out? Thanks!


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 write LIST="$somevariable" instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消