Once the trap catches the signal, there are three ways to react:(1) Execute a procedure to process this signal(2) The default action to accept the signal(3) Ignoring this signalthe trap provides three basic forms for the above three ways:The first
Test-judgedSee below:1 Echo " exist " Echo " Not exist "Determine if/opt/a.txt exists, output exist, otherwise output not existTest also has many uses:
A "file type" judgment about a file name, such as TEST-E filename indicates whether or not it
From: http://blog.sina.com.cn/s/blog_7c95e5850100zpch.htmlSuppose there is a variable var=http://www.linuxidc.com/test.htma # Intercept, delete the left character, and leave the right character. echo ${var#*//} where var is the variable name,#
Similar to other programming languages, the shell supports A for loop.The general format for A for loop is:For variable in list do Command1 command2 ... CommandndoneA list is a sequence of values (numbers, strings, and so on), each
& placed after the startup parameter to set this process as a background processBy default, the process is the foreground process, then the shell is occupied, we can not do other operations, for those who do not interact with the process, many times,
Sch Help Shell Scripting Encryption Geneva I. Span style= "Word-wrap:break-word; Font-weight:normal; font-size:7pt; Font-family: ' Times New Roman ' "> introduction SHC (shell script compiler) shell script compiler. by SHC Compiled
First shell script
Program#!/bin/sh #第一行统一这样写echo ‘abc‘ #输出abc
Run (because the directory is incorrect)[email protected]:~$ test.shtest.sh: command not found
Programme I[email protected]:~$ sh test.shabc
Scenario two (
@1: Sub-string removal${string#substring}The shortest matching $substring is truncated from the beginning of the $string.${string# #substring}The longest matching $substring is truncated from the beginning of the $string.${string%substring}The
chmod u+x./shxx1. Simple Shell Programming SH example executionDisplay the directory and file in which you are located$cat Example#!/bin/sh#this is to show what a example looks likeecho "Our first example"Echo # thisecho "We Are"/bin/pwdEchoecho
Here is a summary of some of the recent learning Shell script knowledge pointsBlog Park-Bang Bang sauce Good * * *1. IntroductionThe shell is a text interface that lets us communicate with the system. The shell script is the one written for the
1, determine if the folder existsif[-d/home/q/www];then Echo"true";ElseEcho"false"; Fi (folder exists in the system/home/q/www)2, determine whether the file existsif[-E/ETC/PASSWD];then Echo"true";ElseEcho"false"; Fiif[-F/ETC/PASSWD];then Echo"true";
First, about this article The monitoring system to be done requires monitoring the usage of disk space and alerting. When testing this feature, it is necessary to simulate two scenarios: one is the need to trigger the alarm mechanism when the disk
The shell is also called the command line interface, which is the interface between the user and the computer under the *nix operating system. The word shell refers to the program in the operating system that provides access to the kernel service.
Shell implementation Associative array
Shell implementation Associative arrayWrite the input and output of the array with the shell; there is a file, the first list of host names, the second column IP address, how to
ArrayConceptA pair of parentheses indicates an array, and the elements of the array are separated by a "space" symbol in the form: array= (value0 value1 value2 value3 ...), when the subscript of the array defaults to 0Basic operations1.arr= (1 2 3 4
Recently due to data migration, some user information needs to be re-confirmed, perhaps a large amount of data, but the need for the final confirmation of such as the user ID and its corresponding number of user points, which will lead to the
Shell programming-sortThe sort sorting operation sorts a row in one or more files according to the set rules. Output to the standard output and will not be saved to any files.-T specifies the filed separator. The default value is space. Multiple
Restart tomcat shell and tomcat shell
#! /Bin/bash #1. Determine whether the service is available. 2. restart tomcat if the service is unavailable. #*/30 *****/home/wsm/restart. sh>/home/wsm/restart. log # Stop tomcatfunction killTomcat () {pid =
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