How the shell intercepts strings

Reference documents:Summary of Shell interception string methods in LinuxHow does [Linux] calculate string lengths in shell scripts?There are eight ways to intercept a string, mainly for the following methodsThere are a number of ways to intercept

Shell (check return of each line) and Sudoer

Shell result from CmdLineecho $?If 0 then success; else failure(Shell executes each return value, RM-RF error, package cannot overwrite)Solve Sudo:sorry, you must has a TTY to run sudo  a few days ago encountered a problem, call another shell in one

Shell script extracts a specified number of random students

#!/bin/bash##!/bin/bash#read-p ' input number ' C #指定抽取的学生人 Number of jw= (' Wang Hao ' Shei Yunsheng ' ke Yang ' He Shingyu ' Repeti soldier ' Dengbellin ' ' Liu Dao ' ' Yang Jidong ' Chu Ziwen ' ' ' Salted fish ' ' Yang Dong ' > Huang Tinghui '

Shell script randomly draws students in class

#!/bin/ bash#JW = (' Wang Hao ' ' Shei Yunsheng ' ke Yang ' He Shingyu ' Repeti soldier ' Dengbellin ' Liu Dao ' ' Yang Jidong ', ' Chu Ziwen ', ' "' Yang Dong '" Huang Tinghui ' ' "," "The" "The" "The" "The" "The" "The" "The" "the" ' Zheng

Tips for using tput in shell scripts (Tput control cursor position)

Knowledge Points:1) Sleep: Used to implement the delay function in the script, sleep N, delay n seconds2) Tput: Change the terminal display characteristics, common usage is as follows:Tput lines: Displays the number of lines of the terminalTput cols:

Shell scripting Exercises (12.11)

For an even number of 100 or lessIdea: 1. Define a variable x firstThe range of 2.x is 0-50,x with an initial value of 13. And the value initial value is 0, each time the loop and the value is equal to itself +2*iMethod One:Vim

CentOS boot automatically executes shell script to start Tomcat server

Sometimes it is necessary to start the project automatically after the start of the CentOS system, when the project is deployed in Tomcat, if the CentOS shutdown after the boot, the project has been stopped, and then need to be a manual to open each

Shell Script Practice Purge Log

In the production environment log is the operation and maintenance personnel to understand and analyze the production environment first-hand information, but the content of the log information is quite large, especially in the public cloud

Initial shell, set port parameters

In fact, I deliberately do not write the deletion of the section, because the management of the server will only add port will not shut down.=====================#! Bin/bashWhile:DoClearecho "Detect Open Ports:"Echo-e "\033[33m '

Initial shell, set SELinux parameters

Turning off SELinux should be replaced with user input variables, but that's fine.==========================================#! Bin/bashClearecho "--------------------"Echo-e "\033[34mthis file controls the state of SELinux on the system.\033[0m"Echo-

Shell scripting Exercises (12.7)

Example 1. Enter any two numbers and make a judgmentVI number.sh#!/bin/bash#written by Lizhengecho "Please enter the number"Read aRead Bif test $a-eq $bThen echo "The No.2"Elif Test $a-gt $bThen echo "The > no.2"else echo "The Fi650) this.width=650;

Seven. Shell script programming

Shell login mode, shell arithmetic operation, Shell logic operation, shell condition test, Shell selection statementShell programming in the first line indicates the path of the shell type to be executede.g #/bin/bash1. Shell Login MethodInteractive

Linux Shell Basics

Shell is the core program kernel outside the instruction parser, is a program, colleague is a command language and programming language--shell is a command parser, the user Input command, it to parse.Shell type ash,bash,ksh,csh,tcsh--cat

Shell script Monitoring (ping) host is alive

#!/bin/bash#http://wangjiatong.blog.51cto.com/#create2016-11-22Ping_success () {If ping-c 1 $IP >/dev/null; ThenEcho-e "\033[032m$ip Ping issuccessful!! \033[0m "ContinueFi}Ip_list= "192.168.217.130192.168.217.142"For IP

Shell Script Process Control

4.1.3 Shell Process Control Statements If condition judgment StatementIf ( expression ) #if (Variable in Array)Statement 1ElseStatement 2FiCase one, test if the directory exists, does not exist then new (note that space must be between the brackets)

Linux Shell Basics

Shell is the core program kernel outside the instruction parser, is a program, colleague is a command language and programming language --shell is a command parser, the user Input command, it to parse.Shell type

Use of expr in the Shell

The 1.expr command is generally used for integer values in the general format:Expr argument operator argumentThe general usage is to do arithmetic operations using expr, such as:[[email protected] ~]# Expr 10 + 2030$expr 30/3/25(Note that operators

Shell Basics Using Notes

Create 10 user user1-user10;[Email protected] ~]# vim user.sh#!/bin/bash #注释为bashFor ((i=1;i#条件Do #动作Useradd user$i # Add user, $i as variable (i=i+1, always execute to iecho "User$i" | passwd--stdin user$i #打印出来, create user password consistent

Shell variable operation

1. Define variables: In order to avoid conflicts with environment variables, generally lowercase: such as pp= "mydql,kdkfeof";Second assignment scheme:The calling variable uses the $ symbol:Variable overlay:2. The output uses ECHO, as shown in:3.

Linux Shell Data redirection

The common input and output operators under the Linux shell are:1. Standard input (stdin): code 0, using 2. Standard output (STDOUT): Code 1, using > or >>/dev/stdout,/PROC/SELF/FD/1 1 for:/dev/stdout3. Standard error Output (STDERR): Code 2, using 2

Total Pages: 541 1 .... 363 364 365 366 367 .... 541 Go to: GO

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.