2
在不扩展/求值的情况下回显其中包含变量的字符串
已关闭。这个问题需要细节或说明。它当前不接受答案。 想改善这个问题吗?添加详细信息并通过编辑此帖子来澄清问题。 4年前关闭。 我到处搜寻。尝试回显和打印。尝试使用单引号和双引号。但是我已经解析了数据并将其分配给一个变量,然后想对其进行评估以了解其中是否包含变量。然后,我将使用通配符替换变量并搜索文件。 例: var="file.$DATE.txt" ### Where it goes wrong- Needs to identify that $DATE is within the $var varaible. test=$(echo "$var"|grep '\$') if [[ $test ]] then ### I would use whatever fix is discovered here as well test=$(echo $test|sed 's/\$[a-zA-Z]*/\*/') fi ### (Actually pulling from remote machine …