Linux shell: 变量与字符串拼接出新变量到if语句

Linux shell: 变量与字符串拼接出新变量到if语句,第1张

不能这样写 "${TN3RD_$(echo ${library} | tr '[a-z]' '[A-Z]')_SUPPORT}"

直接写:

if [ "$library" == "zlib" ]then

echo "${library} is included"

fi

testt=$(date +%Y-%m-%d)

date2="14/08/12"

test=20

testtt="${test}${date2}"

time1=$(date +%s -d "$testt" )

time2=$(date +%s -d "$testtt" )

time=$(($time1-$time2))

echo $time

改成引号,去掉括号!!


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/9020363.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-24
下一篇 2023-04-24

发表评论

登录后才能评论

评论列表(0条)

保存