When you are using some commands, such as: LS, git, just met some requirements is to easily traverse all the directories and files, and then after the search, finally found a "magic" wildcard "* *" (two asterisks), after setting the bash globstar
Invoking awk in a shell script is very natural and simple, and if you need to invoke the shell script/command, you need to use the system () function, which is written as System ("sh my.sh" $var) if you need to pass the variable to the called Shell.
Example one: Drawing Special graphics #!/bin/bashMax_no=0Echo-n "Enter number between (5 to 9):"Read Max_noif! [$MAX _no-ge 5-a $MAX _no-le 9]; Thenecho "WTF ... I ask to enter number between 5 and 9, Try Again "Exit 1FiClearfor ((I=1; i=i;
A few days ago found that the site is not open, prompted the database connection error, I log on to Linux found Mysqld services do not know when to stop. Luckily, I even found out.So I decided to write a shell script to automatically detect the
Monitoring website 80 Ports
Many times we do not know whether the site 80 port is normal, of course, my previous Shell monitoring site status (continued) This article can also monitor the site, here is just to provide you with another way to
Previously only heard DreamHost support shell, but not specifically used, mainly in the past is not very need, has not uploaded too many things.
Recently because to upload a large number of files, suffering from the speed of optical cable can not
SH is not as easy to define and use arrays as bash and ksh, but you can simulate arrays in other ways.
Method 1 simulates an array by using the SET command and positional parameters
# define array
set ' word 1 ' word2 word3
# Output Array's
Objective
I'm sure you all know that bash down time is a very useful command that can be timed for execution of a script or program, which is usually handy when it comes to a rough comparison of program execution efficiency. But you will find that
1.if is a single branch statement, using the following format:
if condition; Then
Statement
.....
Fi
2.if ... else is a two-spoke statement, using the following format:
if condition; Then
Statement
....
Else
Statement
....
Fi
3.if ...
Here I share is learning the computer Shell scripting language method, you may not be in the software industry, but I suggest also look, because I did not say what technical details, the main share is to refine the generality of the method, which is
For the user to enter the validity of the date test is a very important issue, this example is simple to get the user entered the date, and converted to the appropriate format, but not perfect, why please read the text.
#!/bin/sh #
From this beginning, it is the text content operation, which differs from the text operation.
The grep command in a Linux system is a powerful text search tool that uses regular expressions to search for text and print matching rows. The grep full
NC (Netcat) is known as the "Swiss Army Knife" in the network tool, although the volume is small but powerful, NC the simplest function is the port scan, here I take note of it as a file transfer of magical use.
First look at the help information.
In Linux if planning time is a hassle,
Use the awk script as follows
BEGIN {fs= ":"; ofs= ":"}
{total_seconds=total_seconds+$3}
total_seconds>=60 {Total_seconds=total_ sconds-60
$2=$2+1
}
{total_minutes=total_minutes+$2
$2=$2+1
Arithmetic operations are essential in any programming language, and the shell is no exception.
First, use Let, (()) and [] for arithmetic operations
You can use the normal variable assignment method to define a numeric value, which is that it
There are several ways to bash a shell script, assuming that the file name of the shell script we have written is hello.sh and that the file location is in the/data/shell directory and has execute permissions.Method One: Switch to the directory
Save a script file under Windows, upload to CentOS with SSH, add permission to execute Nginx prompt without that file or directory.The shell script is placed in the/etc/init.d/directory, and then executes the/etc/init.d/nginx, prompting more of this
Users want to use Ogg to synchronize data, the original use is Shareplex, as for why to change ogg,bulabula a bunch of reasons .... This is not what we want to care about, and the customer installed after the configuration of Ogg, the test, the
##### #shell Script ##########Bash Script BasicsBASH = GNU Bourne-again Shell,bash is a project developed and promoted by the GNU organization.Bash scripts are similar to batching, simply by putting a lot of instructions together and providing loops,
Last night spent a whole night answering a question about the redirect output to/dev/null in the shell. Decisive tonight also synchronous hair here, anyway no one see ~ ~ ~The following comes from a heavy Linux use patient's unsolicited
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