20.16/20.17 functions in the shell
Implicit functions for displaying variables
Results of execution
parameter is only one 1, the result of the first is 1, the second is empty, the third is empty, the name of the limb is fun1.sh, a total of 1 parameters
Function of addition
Show hidden functions of IP
-A1 is a line that displays keywords, including the next line
Accurate Search to IP
The script can be written like this, the IP $eth is the name of the input network card
#!/bin/bash
IP ()
{
Ifconfig |grep-a1 "ens33:" |awk '/inet/{print $} '
}
Read-p "Please input the ETH name:" ETH
IP $eth
Execution results
When the input ens37 no value, this time need to judge, there are 2 judgments, one is the input network card is not the system in the Internet, not one is, when the input of the Internet no value
20.18 Arrays in the shell
View a value of an array
You can change the value of an element
20.19 Alarm system Requirements Analysis
20.16/20.17 function in Shell 20.18 array 20.19 alarm system requirement analysis in shell