The shell script realizes the query N days before or N days after the specified date 1 1 span> #!/bin/bash
2 func(){
3 read -p “Please enter the year, month and day (format: 2019-01-01): ”
Tag: shell
Shell exercise -17
Question requirementsAssuming that the root password of the current MySQL service is 123456, write a script to check whether the MySQL service is normal (for example, you can enter mysql normally t
Shell Training Day7 8.21
? [-f file] Determine whether it is a normal file and exist
? [-d file] Determine whether it is a directory and exist
? [-e file] Determine whether a file or directory exists
>? [-r file] Determin
Shell script – GREP and regular expressions
grep command
1, grep program: Linux Three Musketeers–grep, awk, sed
2, GrepL: text line filtering tool
Awk: report generator (formatting text output)
3, grep contains three
Shell write progress bar
test.sh
#!/bin/bash
i=0
bar=‘‘
label=(“|” “/” “-” “\\< span style="color: #800000;">“)
while [$i -le 100]
do
printf “[\e[43;46;lm%-100s \e[0m][%d%%][%c]\r” “$bar” “$i” “${label[i%4]}”
Shell Programming
1. Variable A=8
echo $A
echo “$0 $1 $2”
echo “$*”
echo “[email protected]”
echo “$#”
S=$[(2+3)*4]
= String Compare
-lt less thanless than
-le l
Shell string stitching
test.sh
#!/bin/bash
your_name=”runoob”
# Use double quotes to splice
greeting=”hello, “$your_name” !”
greeting_1=”hello, ${your_name} ! ”
echo $greeting $greeting_1
# Use single quotes
SHELL variable foundation detailed
1. Introduction to variables Variables are places where data is temporarily stored and data tags. The stored data exists in the memory space, and the data corresponding to the variable can be retri
Use of the function in the shell
function is a script code block, you can name it yourself, and you can use this function anywhere in the script. If you want this function, just call the name of the function. The advantage of usin
Shell script writing code
Now centos7 is using the bash software, you can view the bash version through the following command:
[[email protected] ~]# cat /etc/redhat-release #View the system version
CentOS Linux rele