如何在redhat Linux的shell脚本中将Bash变量设置为文件的内容,该文件只有一行,然后在其后添加一些文本。
例如:
echo "Version 1.2.3.4" > $TMPDIR/devver
env=dev
export ${env}_result="`cat $TMPDIR/${env}ver` (No response - version is from cache)"
echo $dev_result
我希望输出为:
Version 1.2.3.4 (No response - version is from cache)
相反,我在版本之后得到一个换行符,如下所示:
Version 1.2.3.4
(No response - version is from cache)