我的 shell 脚本中的行是
OUTPUTMESSAGE="****Warning error $MYERRORNUM ****"
echo $OUTPUTMESSAGE
星号扩展为文件名,所以看起来像
file1 file2 file 3 file4 Warning error 404 file1 file2 file 3 file4
如何防止 echo
中的 *
扩展?
最佳答案
不仅在赋值中引用变量名,而且在你的echo
命令中引用变量名:
OUTPUTMESSAGE="****Warning error $MYERRORNUM ****"
echo "$OUTPUTMESSAGE"
更多信息可以在 this question 的答案中找到。 .
关于linux - 我如何将星号回显到输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26833786/