2-3 shell命令替换
2020-02-18 本文已影响0人
AntKing
image.png
var1=`date`
echo $var1
var2=$(date)
echo $var2
输出结果
Tue Feb 18 12:45:37 CST 2020
Tue Feb 18 12:45:37 CST 2020
var2=$(date +%Y)
echo "this is $var2 year"
输出结果
this is 2020 year