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
Every time you build a new SVN version of the library it's always a lot of fun, so write a section of the script to automate the process, the detailed code is as follows:
The code is as follows
Copy Code
#!/bin/bash# by
The original script:
The code is as follows
Copy Code
#!/bin/bashFile= "/root/newfile/"List= "/root/sqlbak"Ls-l $list/|awk ' {print $} ' |while read lineTodoCp-r $list/$line $fileDone
Modified script:
Script content:
The code is as follows
Copy Code
VI iptables-reset.sh#!/bin/bash#Powered by blog.slogra.comport= ' Iptables-vl|grep Ssh|awk ' {split ($NF, A, ":");p rint a[2]} ' |wc-l 'if [$port = 1];thenecho
The IF statement in the shell needs to make a regular judgment and check the grammatical records.
The code is as follows
Copy Code
Datepattern= "^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$"if [["$STARTDATE" =~ $DATEPATTERN]] && [[
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
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
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
Renamed a Web project, and then modified the Apache configuration to a new directory restart, the following error message appears:
Shell-init:error Retrieving current Directory:getcwd:cannot access parent directories:no such file or directory
The most common source package downloaded from the network is. tar.gz package, and part of the. tar.bz2 Package
To decompress is simple:
. tar.gz Format Decompression command for TAR-ZXVPF xx.tar.gz. tar.bz2 Format Decompression command for
Part 1: ' Command '
This is the "command standard output as a function of standard input" method of operation, there are great drawbacks and unsafe places.
disadvantage one: relatively old.
disadvantage two: easy to confuse with single quotes.
Recently write script, need to intercept the path parameter that function passes in the script, discover the following more useful method, record below:
File=/dir1/dir2/dir3/my.file.txt
We can replace each of the different values with ${}:
${file#
Presumably, anyone who knows makefile knows that makefile can invoke a shell script. But when it's actually used, it's not that simple, and some ambiguous places can make you mad. If you don't believe it, you can take a look at a few examples,
Submit Process Related
View file changes and new files
Add new File
git add Your_file_path
//Add all Files
git add *
//Add a type of file
Simple submission of files
Submit all of your modified files and
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
Nginx service startup script The code is as follows:Copy code #! /Bin/sh# Chkconfig: 2345 55 25# Description: Startup script for nginx webserver on Debian. Place in/etc/init. d and# Run 'UPDATE-rc. d-f nginx defaults', or use the appropriate
Note: Operating system: CentOS Web server: apache Problem: Search engine crawlers increase website access volume in a certain period of time. The server is under heavy pressure, the website access times out, and the page cannot be
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