First, what is the shell?
%H hours, 24-hour (00~23)
%I Hours, 12-hour (01~12)
%k hours, 24-hour (0~23)
%l hours, 12-hour (1~12)
%M min (00~59)
%p Show AM or PM
%r display time, 12-hour system (HH:MM:SS%p)
%s from January 1, 1970 00:00:00 to the number of seconds currently experienced
%s Display seconds (00~59)
%T display time, 24-hour system (HH:MM:SS)
%x shows the format of Time (%h:%m:%s)
%Z Display time zone, date field (CST)
%a week abbreviation (SUN~SAT)
Full name of%A week (Sunday~saturday)
%h,%b month abbreviation (JAN~DEC)
Full name of%B month (January~december)
%c Date and time (Tue Nov 20 14:12:58 2012)
%d the day of the one month (01~31)
%x,%d Date (MM/DD/YY)
%j the first day of the Year (001~366)
%m Month (01~12)
%w Day of the week one (0 for Sunday)
%W Week of the year (00~53, Monday for first day)
The last two digits of the%y year (1999 is 99)
Iv. variables in shell scripts
- You should use a variable instead when you use a string more frequently in your script and the string length is long
- When using conditional statements, variables are often used?? If [$a-gt 1]; Then ...; Fi
- When referencing the result of a command, replace it with a variable?? n=
wc -l 1.txt
- When writing scripts for user interaction, variables are also necessary?? Read-p "Input a number:" N; echo $n?? If you don't write this n, you can use $reply directly.
- Built-in variables, $ $, $ ...? ? $ A represents the script itself, the first parameter, the second ...? ?? ? $ #表示参数个数
- Mathematical Operation a=1;b=2; c=$ (($a + $b)) or $[$a + $b]
68.shell Script Introduction, shell script structure and execution, date command usage, variables in shell scripts