Now, the project must create a new folder for the file to be uploaded, and upload the file to this folder with the name of the current time, one of the key points is that if you create a folder for a remote host, the command for creating a folder is mkdir xmphoenix. But how can you get the time?
#! /Bin/bash
B = $ (date + % Y-% m-% d)
Cat B
This simple step shows the value of parameter B.
# A is the current date
A = $ (date + "% Y % m % d ")
# B is the 8 days before the current date
B = $ (date-d "8 days ago" + "% Y % m % d ")
Obtain the current period:
'Date + % Y % m % d' or 'date + % F' or $ (date + % Y % m % d) Get the period of yesterday:
'Date-d Yesterday + % Y % m % d'
Get date of the day before yesterday: 'date-D-2day + % Y % m % d'
And so on, for example, get the date 10 days ago:
'Date-D-10day + % Y % m % d'
'Date-d "n days ago" + % Y % m % d' n days ago'
Tomorrow: 'date-d tomorrow + % Y % m % d' note that there are spaces in the middle
Time Domain
% H hour (00 .. 23) % I hour (01 .. 12) % K hour (0 .. 23) % L hour (1 .. 12) % m (00 .. 59)
% P displays am or PM % R time (HH: mm: SS am or pm)
12 hours % s the number of seconds that have elapsed since January 1, 1970 00:00:00
% S seconds (00 .. 59)
% T time (in 24-hour format) (HH: mm: SS)
% X display time format (% H: % m: % s)
% Z Time Zone Date Field
% A abbreviation of the day of the week (Sun... Sat )...