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
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]];
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
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
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
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
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,
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
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
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
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,
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
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 (
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
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:
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
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
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
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