shell script reference time

Backticks:
`` backquote content inside the command, the command can be output by the shell back quotes users assigned to variables, such as:

#!/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

 

Guess you like

Origin www.cnblogs.com/xl-892694298/p/11016621.html