Not long ago I saw two interesting commands in the book--script and Srciptreplay, which can record a terminal session in a file, that is, we can create a command-line video tutorial through a terminal session, or we can share session files with
1. Simple method
Copy Code code as follows:
$ b=$ ((5*5+5-3/2))
$ echo $b
29
In the Linux shell, we can use $ (()) to put an expression in parentheses to achieve the function of the operation.
2. Other methods:
Using:
Question: Https://www.jinshuju.net/f/EGQL3D
Language: Shell (Bash)Operation mode:SH num-game.sh digit 1 digit 2 Number 3If you do not want to use the method of passing numbers, you can modify num-game.sh line 9th tonum=$*Tonum= ' number 1 digit 2
Use the MySQL shell command to read the database information, delete the specified fields, and the corresponding files of the field, the Linux platform.
The preceding variable is defined as the data base configuration
Copy Code code as
Copy Code code as follows:
#在后台执行 cmd command
CMD &
#命令序列. Execute multiple commands on the same lineCMD1; Cmd2
Execute multiple commands in a #在当前 shell in a set of forms{cmd1; cmd2;}
Execute multiple commands in a #在子 shell in a set
These days found that CentOS system memory has been up, even if the Apache and MySQL closed, memory is not released, you can use the following script to free memory:Script content:
Copy Code code as follows:
#! /bin/bash
# Cache
In a multiple-machine cluster environment, often faced with the modification of the configuration file after copying to multiple servers, the traditional implementation of the SCP is troublesome, so write the following shell script, you can copy the
This article describes the implementation of the core file automatic generation configuration method, the following steps:
1. Edit the Environment configuration file, let the shell start automatically set Ulimit
Vi/etc/profile
ulimit-c
Sometimes, because of the architectural design or other business itself characteristics, resulting in some applications using CPU is very uneven, so business processing concentrated on one CPU, while the other CPU idle sleep. Here is a simple
There are times when you need to extract files from the RPM package without installing and installing RPM-related libraries and programs, and this little green script can help you achieve your wish.
Note:1. This script comes from the Internet, the
For example, to split test= "AAA,BBB,CC cc,dd dd", you can
Copy Code code as follows:
arr=$ (Echo $test |tr "," \ n ")
I can do that.
Copy Code code as follows:
old_ifs= $IFS
Ifs= ', '
Arr= $test
ifs= $OLD
In our system, I wrote a script to update some repository on a regular basis, but occasionally I encountered problems, such as when git pull might be stuck there (possibly due to a network problem at some point), which would hinder the next
When dealing with some data files on Linux, it is sometimes necessary to filter out the empty rows, and the various tools available in the system can accomplish this function. The usual introductions are as follows:1. grep
Copy Code code as
Often need to statistics Apache site traffic based on the IP address, the most basic script.
In descending order based on IP traffic:
Copy Code code as follows:
#!/bin/bash
#Script_name: Access_count
This example describes the Jquery.fancybox.js usage of the jquery Pinball plug-in. Share to everyone for your reference, specific as follows:
FancyBox is a jquery plug-in, powerful. Support to enlarge the picture to add shadow effect, for a group
First, take an integer d1 less than n as the first increment, dividing the entire record of the file into D1 groups. All records that are multiples of the DL are placed in the same group. A direct insertion sort is performed within each group, and
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