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
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
The shell script prints the nine-nine-nine multiplication table #!/bin/bash
for i in {1..9}
do
for j in {1..9}
do
if [$j -le $i]
then
echo -n “${j}X${i}= $(($i*$j)) ”
fi
done
Flow controlLogic processing in programming: Sequential execution
Select execution
Circular execution Loop Loop execution
Repeat a certain code segment several times
How many times it repeats
T
Advanced script oneOne, the second way of writing for loop:
As we all know, there are two ways of writing for
< strong>How to write directly:
Two parentheses must be written after
When the Shell script runs, it will first look for the system environment variable ENV, which specifies the environment file (the order of loading is usually /etc/profile, ~/.bash_profile, ~/.bashr
test.sh
#!/bin/bash
echo “Script name$0”
echo “The first parameter $1”
echo “The second parameter $2”
echo “The third parameter $3”
echo “The fourth parameter $4”
echo “The fifth parame
1. Special location variables
About the above related variables introduction , You can also refer to the man manual, execute the command “man bash”, and then search for the keyword “Special P
1. Text processing tools
wc command
wc (Word count) is used to count the number of characters in a text file
15 is the number of lines 78 is the number of characters 805 is the fi
Shell script printing rectangle #!/bin/bash
for ((i=1;i<= 9;i++)) do for ((j=1;j<=9;j++)) do echo -n "*" done echo done
#!/bin/bash
for ((i=1;i<= 9;i++)) do for ((j=1;j<=9;j++)) do echo -n "*" done echo done
1. The writing method of for statement based on C language format:
for((i=0;i<10;i++)); do【for (initial conditions ; Conditional judgment statement; Value change statement); do】
loop bo