Linux shell Simulation multithreaded implementation of the task detailed

The shell itself cannot be multi-threaded, but it can simulate multithreading by starting the subprocess and putting the child processes into the background, in order to increase the efficiency of the script while not significantly increasing the

Recommend a shell script to get the Linux server (Ubuntu, CentOS tested) information

This script has been tested on the Ubuntu and CentOS versions, and the source code is much more straightforward: The code is as follows Copy Code #!/bin/bash Line= ' =========== ' #linux发行版名称if [[-f/usr/bin/lsb_release]];

Shell String Lookup Replace regular operation

Examples of string operations in workFilename= '/home/admin/jobs/cnclickstat/dfsloader/loader.cfg '#下面是使用shell字符串操作buname1=${filename#*/jobs/} #去除 '/home/admin/jobs/cnclickstat/dfsloader/loader.cfg ' prefix get ' CnClickstat/DFSLoader/ Loader.cfg

The absolute path of the directory where the shell script resides in Linux

The code is as follows Copy Code basedirforscriptself=$ (CD "$ (dirname" $) "; pwd)echo "full path to currently executed script is: ${basedirforscriptself}"Orfullpath=$ (CD "$ (dirname" $) "; pwd)echo "full path to currently executed

Use shell script to insert a record every 100 rows and record the first column contains row number other columns unchanged _linux shell

1. Example: Insert a record every 100 rows, and the first column of this record contains the line number, and the other columns are the same as the first row #!/bin/sh var= "00001" # variable cat A.txt|awk ' nr==1 ' |while read Line # Get the

A method for obtaining remote files from the SCP command in Linux _linux shell

First, what is the SCP? SCP is a secure copy of the shorthand for remote copy of files under Linux commands, and its similar command has CP, but the CP is only on the local copy not across the server, and the SCP transmission is encrypted, may

Control the output color of the shell script _linux shell

Implementation code: #!/bin/sh # ANSI Color-Use this variables to make output in different colors # and formats. Color names that end with the ' F ' are foreground (text) colors, # and those ending with ' B ' are background. Initializeansi

101 shell script guessing number game code _linux shell

The original book This example is to teach debugging script, it deliberately gave a few errors in the script, teach us to understand the system prompts the error, and modify the run. But it's more difficult to write, so put the modified script up,

Linux shell Programming Shortcuts Daquan (daily collation) _linux Shell

Sometimes we need to repeat the previous commands in Bash. You can, of course, use the UP ARROW keys to view the commands you've run before. But there are some better ways, for example, to master the following shortcuts. 1)!! : Repeat the previous

Shell script Programming Loop statement _linux Shell

It is common to repeat a series of commands while running a script, when we need to use a loop statement to do this. One, for command Format: for variable in list; Circulation body Done The for command traverses each value in the list and exits

Linux to monitor network traffic script _linux Shell

I looked at the/proc/net/dev under Linux to record the number of packets and bytes sent and received by each network card. So initiation thought, wrote one. Operation Effect: Copy Code code as follows: [root@74-82-173-217

Sharing several tips in shell programming _linux shell

1. Print some header informationCommand ............Dilimiter The standard input of the command as the content of the boundary symbol DilimiterCommonly used in the echo command, this avoids the need to use an echo command without outputting a line,

Backup shell script instance code _linux shell

1, backup_run.sh Copy Code code as follows: #!/bin/sh # Backup_run # script to run the backups # loads in a setting file for the ' user to ' change Source=/home/bob/backup.defaults Check_source () { # Check_source # Can we load

Delete a Web site with the shell command the latest NB method and code _linux

Copy code code as follows: # Is it really a headache, or do you want to write a shell script to get rid of these scripts Copy Code code as follows: #!/bin/sh LS $1/*.htm | While read file Todo Sed-i-E "/if (

SVN-based Code submission statistics tool implemented by shell script _linux Shell

svn

Nothing recently, I wrote a code statistics gadget based on SVN in bash. You can specify a catalog of statistics, and the default recursive statistics subdirectory. Currently, there is no capability to mask the specified directory. The code is

Bash Shell programming Exercises

Original file:Find/etc-name passwd 2>&1 | Tee Ee.log1. Cat-n The document contents of the E.log with the line number and enter E2.log in this document:[Email protected] ~/t2scripts $ cat-n E.log |Tee E2.log1/etc/passwd2 3 4Find:

Install Zsh's shell under Mac to replace the original bash

ZshThe Mac system comes with zsh, which is generally not the latest version, and can be installed by Homebrew if requiredBrew Install Zshzsh --versionversion of Zsh can be viewed by commandUse echo $ZSH_VERSION the command to view the ZSH version

Execute shell script and Subshell.

Two methods Start a new shell and execute the shell scripts. Shell scripts at the moment. The scripts that brings up another shell will be added to the front of the scripts file. #! /bin/shThe first approach is to point out

JMeter Bean Shell Use (ii)

Previous JMeter Bean shell Use (a) a brief introduction of the bean shell in the next jmeter, this article is a supplement to the above, mainly summarizes the common scenarios and methods, I believe these basic can cover most of the needs. This

Total Pages: 541 1 .... 186 187 188 189 190 .... 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.