① linux中用shell時奇怪的字元串拼接和時間計算問題
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
改成引號,去掉括弧!!
② Linux shell: 變數與字元串拼接出新變數到if語句
不能這樣寫 "${TN3RD_$(echo ${library} | tr '[a-z]' '[A-Z]')_SUPPORT}"
直接寫:
if [ "$library" == "zlib" ];then
echo "${library} is included"
fi