Shell script: The Interception of strings

In shell scripts, all of our variables are stored as strings. So it becomes very important for the interception of strings.In a shell script, if you want to specify a string for interception, there are several ways to do it:The following examples

To intercept a string in a shell script

1. Remove the left character and leave the right character1). Use # InterceptExample: str= "http://www.baidu.com"650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/82/DC/wKioL1djQu_CLXeEAAAzIuXnc10469.png-wh_500x0-wm_3

A simple description of the shell variable

$*[Email protected]DifferenceThe shift parameter moves forward one bit, moving the position variable.$?$n$#$$!$$#!/bin/shPidpath=/tmp/p.pidIf [-F "$pidpath"]ThenKILL-USR2 ' Cat $pidpath '/dev/null 2>&1Rm-f $pidpathFiecho $$ > $pidpathSleep 300One of

Linux Gvim Shell functions

#函数: Must be defined before using#格式:#function_name () {# List of commands# [return value] #可以显示增加return语句, if not added, the last command runs the result as a return ##返回值只能是整数, generally used for function execution success or not, 0 for success,

Linux Learning--shell

Overview What is a shell?The shell acts as an interface between the user and the Linux system, allowing the user to enter commands that need to be executed to the operating system. This is much like the command prompt for Windows, but the strong is

Linux Shell Execution principle

Shell IntroductionThe shell is the user interface of the system and provides an interface for users to interoperate with the kernel. It receives the command entered by the user and feeds it into the kernel to execute.Running backgroundA basic Linux

Shell Script Delete Partition

#!/bin/bashSource/etc/profileSOURCE ~/.bash_profile##################################00 * * */bin/bash/utxt/soft/tools/rm_oracle.sh >>/utxt/soft/tools/rm_oracle.log 2>&1#################################lyd_rm_dt= ' date-d '-5 day "+%y%m%d"flow_rm_dt=

Shell Combat Log desensitization

The actual combat target for the log desensitization, the log directory of all the files processed, all involved in the card number and password information, will be replaced by "*" number, to replace the contents are obtained from the corresponding

Regular expressions in the shell

1. Regular and wildcard characters The wildcard characters in Linux are used to match the file names, and their matches are exact matches. Only wildcard characters are supported, command has LS find CP and other commandsThe regular is used to match

Several methods of operation of Shell

a.expr normal addition multiplication operation Note: Expr can only perform integer operationsExpr 2 + 2Expr 2-2Expr 2 \* 2Expr 2/2Attention:1. Operators and calculated numbers have at least one space around them2. Using multiplication sign, you

Operation expression under the shell

Commonly used arithmetic operators, assuming that variable A is 10 and variable B is 20:Operator Description Example+ addition ' expr $a + $b ' result is 30.- subtraction ' expr $a-$b ' result is 10.* multiply ' expr $a \* $b ' result is 200.

Print out 1,11,21,31,41 ... The shell script

Print out 1,11,21,31,41 ... The shell scriptmethod One:#!/bin/Bash for((i=1;i the; i=i+Ten)); Doecho $i #cat-n/etc/services | Sed-n"${i}p"#sed-N"${i}p"/etc/ServicesdoneOperation process, first cycle:1;1echo "1"Second cycle:1=1+10=11;11echo "11"Third

Server nginx with Shell statistics concurrency

# netstat-an| grep ': 80 ' | awk '/tcp/{a[$NF]++}end{for (i in a) print i,a[i]} '# echo "Current concurrency: ' netstat-ant | grep:80 | awk ' {print $} ' | Awk-f ":" ' {print $} ' | Sort | uniq-c | Sort-r-N | awk ' begin{total=0}{total+=$1}end{print

Shell simple Use (v) variable two

1. Read reading variables from the keyboard  2. Declare/typeset declaring variable typesA. The-i option of the DECLARE command specifies that the variable is an integer type (the default is a string)  B. The-X option of the DECLARE command specifies

Script sequence when user logs in to shell

When a user logs on to a Linux system, the login shell executes the required script in the following order.First, execute/etc/profile this startup script, in/etc/profile This startup scripts will call all the startup scripts in the/ETC/PROFILE.D

Linux-based shell programming (1)

Shell: A weakly typed programming language What is a weak type and what is a strong type? Strongly typed: Variables must be declared beforehand and even initialized before they are used; Weak type: variable time

Shell from getting started to giving up (bottom)

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/20/wKiom1c4dD-wFZx7AAAbgLBZiMU936.jpg "title=" Wkiol1cwdpjb1fbhaaabfqyv8vs885.jpg "alt=" Wkiom1c4dd-wfzx7aaabglbzimu936.jpg "/> First, the great cycle of the For loop

Shell-1.shell notes

Shell annotations1. Single-line CommentLines that begin with "#" are comments, which are ignored by the interpreter.debian:/# Vim first.sh#!/bin/sh#This is my first shell (this line is a comment)echo "Hello World"2. Multi-line annotationsThere are

Basic algorithm programming for shell scripts

First question: Recursion and non-recursion of Fibonacci sequencesNon-recursive:650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/82/EF/wKiom1dl-8rD92igAAB-pImrC88891.png-wh_500x0-wm_3 -wmp_4-s_582408408.png "title=" series non-recursive

Hill sort (Shell sort)

1. DefinitionThe Hill sort (Shell sort) is a sort of insertion. Because of D. L The shell was named after it was introduced in 1959.2. Basic IdeasFirst, take an integer less than n D1 as the first increment, dividing all the records of the file into

Total Pages: 541 1 .... 532 533 534 535 536 .... 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.