【问题标题】:how do I echo an asterisks to an output如何将星号回显到输出
【发布时间】:2014-11-09 21:57:19
【问题描述】:

我的 shell 脚本中的行是

OUTPUTMESSAGE="****Warning error $MYERRORNUM ****"
echo $OUTPUTMESSAGE

星号扩展为文件名,因此看起来像

file1  file2 file 3 file4 Warning error 404  file1  file2 file 3 file4 

如何防止echo 中的* 扩展?

【问题讨论】:

标签: linux output echo


【解决方案1】:

不仅要在赋值中引用变量名,还要在echo 命令中引用:

OUTPUTMESSAGE="****Warning error $MYERRORNUM ****"
echo "$OUTPUTMESSAGE"

更多信息可以在this question的回复中找到。

【讨论】:

    猜你喜欢
    • 2012-06-15
    • 2014-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多