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
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
本文标题:2-3 shell命令替换
本文链接:https://www.haomeiwen.com/subject/izkgfhtx.html
网友评论