1.shell script gets the native IP address:localhostip= ' lc_all=c ifconfig 'inet addr:'127.0.0.1' | '{print $}'"$localhostIP"2. Automate the setup of an IPSec test environment:#!/bin/Bash#sudo Suecho"Get root! "apt-get Install Strongswan-
There are two ways to send a shell script:Way 1:sh file.sh arg1 Arg 2 ....Mode 2:read-p "hint" Arg 1 arg2The default parameters are directly separated by a space, following a few examples to explain the problems encountered in the communication and
There are three main steps to completing tasks and monitoring manually:1. mission_cron.php (timed automatic task script):2. Mission_cron_monitor (run by crontab, monitor the above script):#/bin/bash# Monitor the timer and disconnect the reboot. # #
Case one:Monitoring Web Site Directory ( /var/html/www ) If all files are tampered with (the contents of the file have been changed), if there is a file name (e-mail) to print the changes, the scheduled task every 3 minutes to execute onceMonitoring
1. Unlike Java, PHP and other languages, SH's process control is not empty, such as (the following is the PHP Process Control notation):You can't write this in Sh/bash, and if the Else branch doesn't have a statement execution, don't write this else.
Preface: Before we get to the point, let's review the conditional tests on scriptingOne, Process Control
Over-programming languagesA. Sequential executionB. Select executionC. Cyclic execution
Sequential executionAs the name implies, it is
One: function classification
Local function (local variable)local variable name. modifications to variables in the local function are only valid during the current function run. Func1 () {local Name=test;echo "func1:name= $name"; local
Ctrl + d 删除一个字符,相当于通常的Delete键(命令行若无所有字符,则相当于exit;处理多行标准输入时也表示eof)Ctrl + h 退格删除一个字符,相当于通常的Backspace键Ctrl + u 删除光标之前到行首的字符Ctrl + k 删除光标之前到行尾的字符Ctrl + c 取消当前行输入的命令,相当于Ctrl + BreakCtrl + a 光标移动到行首(Ahead of line),
CGI according to the definition of Baidu Encyclopedia, as follows:CGI is the specification of external programs when the Web server is running, and programs written by CGI can extend server functionality. CGI applications can interact with the
1.1 The following table is a common two-dimensional comparison operatorWe can also see through the man testTips(1) The ".(2) the ">" symbol is greater than the meaning, if[["$a" > "$b"]], if[["$a" \> "$b"]. You need to escape in parentheses because
1.1 String test operatorThe string test operator has the function of comparing whether two strings are the same, whether the length of a string is zero, whether the string is null (NOTE: Bash distinguishes between 0-length strings and empty strings,
First, Shell introduction
The
Shell is a command interpreter that provides interaction between the user and the machine
supports specific syntax, such as logical judgment, looping
each user can have their own specific shell
Shell's variable functionVariables are an important part of the shell, and we know that Linux is a multiuser, multitasking environment where everyone gets a shell when they log into the system, and everyone can use Bash to execute mail to get their
1. Requirements
Reed is a system administrator who needs to add a teacher and several student users to a server in a classroom, manually adding too much trouble, and ask you to write a bash script for him userctr.sh implement bulk add and
Sometimes in some service management scripts to see the $ "$string", after some tests, found that the outside of the quotation marks is the same as No. Just turned the man bash and found an explanation.(1). If there is no special custom bash
20.5 logical judgments in shell scripts
If judgment
#if If the 1:if condition of the Chinese language; fi[[email protected] ~]# a=5;if [$a-gt 3];then echo OK; fiok; The reference text format is as follows: # !/bin/basha=5if [$a-gt 3]
The article is for personal opinion, please correct me.
Before we introduce the shell script, let's begin by understanding some basic concepts. What is a program? Process? The program is a set of instructions plus data, the following diagram
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.