反引号:
`` 反引号里面的内容是命令行,通过反引号用户可以将shell命令的输出赋给变量,比如:
#!/bin/bash
test=`date +%y%m%d`
process_day1=`date -d today +"%Y-%m-%d %H:%M:%S"`
process_day2=`date -d "-1 hour" +"%Y-%m-%d %H":00:00`
process_day3=`date -d today +"%y%m%d"00`
echo “The time is :” $test
echo “The time is :” $process_day1
echo “The time is :” $process_day2
echo “The time is :” $process_day3