Example of shell concurrent programming in Linux

In Python, there are many modules that enable concurrent programming, such as threading, processing, Eventlet, and Stackless python. So how does it work for the shell? In fact, the principle is very simple, I used the method is:1. The tasks that

Linux Shell Curl Command gets the HTTP status code

By curl the-w parameter we can customize the output of the curl,%{http_code} represents the HTTP status code The code is as follows Copy Code # curl-i-M 10-o/dev/null-s-W%{http_code} www.111cn.net The above

Shell monitoring iptables rules are changed

System: CentOS 5.xScript content: The code is as follows Copy Code #!/bin/bashif [!-F. Count];thenIptables-l-n|md5sum|awk ' {print $} ' > ~/.countExit 1ElseIptables-l-n|md5sum|awk ' {print $} ' >~/1.txtDifffile= ' diff ~/

The use and skill of shell commands in Linux

Using the Linux shell is my daily basic work, but I often forget some useful shell commands and L tips. Of course, I can remember the order, but I'm not sure I can remember how to use it to perform a particular task. So I began to record these

Shell Bulk Delete directory under specified directory

Take. SVN example For example, if I want to delete all the. SVN directories under/data/web/, then execute the following command. The code is as follows Copy Code Cd/data/webFind. -type d-name ". SVN" |xargs RM-RVF

Shell loops process daily data in Linux

A date loop that is useful in processing some data that is stored by date. Especially testing and recording, deleting, reprocessing data. However, if you encounter a situation such as the span of a month, simply using a numerical cycle is not

Special variables in the shell ($ A, $#, $*, $@, $$, $!, $, $1~ $n)

In the shell, $* and [email protected] respectively represent the following meanings:$ A: The name of the script itself$#: Number of positional parameters$*: All positional parameters will be treated as a string[Email protected]: Each positional

Shell common list of special variables

Variable Meaning $ Gets the file name of the current execution shell script $n Arguments passed to the script or function. N is a number that represents the first few parameters. For example, the first

Shell Contact 2

See if there are any custom users (ordinary users) on your Linux system, and if so, how many are there?[email protected] ~]# cat 6.sh#/bin/bashN= ' awk-f: ' $3>=500{print '/etc/passwd |wc-l 'If [$n-gt 0];thenecho "$n Common users"Elseecho "No common

The Shell of Linux

The shell is the interface that the user interacts with the system, which is one of the basic ways. The standard shell is bash.Shell's Operation: Show all used commands: history. Execute a command that has been recently executed:!!。 The

Special usage of $0,$?,$! in shell

Variable Description:$$ The PID of the shell itself (Pro CESSID) $! PID of the last background process run by the shell $? End code of the last command run (return value) $- Flag list set with the SET command $* All parameter lists.

Chapter 10th Shell Programming (1) _ Regular expressions

1. Basic Regular Expressions1.1 regular expressions and wildcard characters(1) A regular expression is used to match a string that matches a condition in a file , and a regular contains a match . grep, awk, sed, and other commands can support

A classic and practical iptables shell script

PS: This iptables script is good, very practical, according to the actual application changes can be used by themselves. Share it for everyone to reference. Original author Anonymous. The source code is as follows:#!/bin/sh#Modprobe

Shell Programming (iv) globbing

Globbing: File name wildcard (whole file name match, not part)Match pattern: metacharacters*: matches any character of any lengthpa*, *pa*, *pa, *p*a*PA, PAA, passwd?: matches any single characterPa??? PA, P?a, P?a?PA, PAA, passwd[]: matches any

You can use System to execute complex shell commands in awk

The shell command can be executed directly in awk.[Plain]View PlainCopy [Email protected]:~$ Touch A [Email protected]:~$ Touch b [Email protected]:~$ cat A.txt A B [Email protected]:~$ awk ' {cmd= ' rm ' $0;system (CMD)} ' A.txt

Shell script Execution Conflict event-ssh&while

Today we find a problem: Read the following script: [email protected]/0 # cat ! $cat  /tmp/test_nginxls *.txt |  tr  '   '   ' \ n '  | while read linedo echo  $lineif  [  ' Yes '  ==  ' yes '  ]thenssh  192.168.109.10  ' echo  ' yes ' "elsessh  192.

The shell implements a two number addition

Write at the beginning, always write wrong, seemingly simple function, but must be careful; function definition:Funciton functionname {...} There must be a space between functionname and {! I just did not add a space, has been an error.Implement two

Enterprise Shell interview questions: Get 51CTO Blog list Reverse sort exam questions

#!/bin/shPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/binHTMLFILE=/home/oldboy/htmlHTTP=http://oldboy.blog.51cto.com/all/2561410NUM=$(curl $HTTP |awk-F "[ /]"‘/页数/ {print $(NF-3)}‘)[ -d $HTMLFILE ]||mkdir$HTMLFILE -pecho

Simple nginx log segmentation shell script

Nginx log access. log is not separated, and access records are always recorded in this file. For a long time, log query and file system are not good, so segmentation is required.Vim/data/scripts/cut_nginx_log.sh #! /Bin/bash# Auto-run this

Shell script for replacing the content in files in batches in Centos

Replacing File content in Centos in batchesThese two Angels used the locomotive to collect some data because they generated a lot of SQL files. I want to replace the fixed content in each SQL file with another content.Manual file configuration

Total Pages: 541 1 .... 362 363 364 365 366 .... 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.