20.16/20.17 function in Shell 20.18 array 20.19 alarm system requirement analysis in shell

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.