UsageParameter 1, write the text that needs to replace the path record, format: Old path old name new path new nameParameter 2, directory of files that need to be replacedParameter 3, type of file that needs to be replaced
Copy Code code as
Because I've been working on some JSON data formats recently, I finally found JQ this great tool after a search. JQ allows you to manipulate JSON directly under the command line, including slicing, filtering, converting, and so on.Let's use a few
The general shell script debugging is basically echo to deal with the larger script when, it is more trouble, out of the question, is not very good to locate which line of code problems.In fact, some of the variables built into the shell can be a
1. Operator (let marker)
+ Addition-Subtraction* Multiplication/Division* * Power operation3 Let "z=5**3"% modulobash$ Expr 5% 3
2. The comparison character (note [] and the variable need Space "")
Integral type comparison character-eq equals,
A script to compress the picture, install the #imagemagick# first
Copy Code code as follows:
#!/bin/bash
# yum Install ImageMagick
# Cd/img/dir
for file in */*.jpg; TodoTo_middle_file= "${file%.*}_m.${file##*.}"; FileName plus
A shell script, what is its command parameter?First, shell scripting and scripting like Python can use parameters as well;Secondly, the shell parameters are divided into positional parameters and internal parameters;Where, positional parameter: is
All executed scripts need root identity to execute: Execute the command as root: Bash xxx.sh
Function: Automatic detection system and update sourceApplicable system version: compatible with all Linux versions on lineHow to: Execute a command as
There are a number of ways to bash the shell script, now make a summary. Suppose we write a shell script with the file name hello.sh, the file location in the/data/shell directory, and already have execute permissions.
Method One: Switch to the
ECHO is an internal instruction of the shell to print out the specified string on the screen. Command format:
Copy Code code as follows:
Echo Arg
You can use echo to achieve more complex output format control.
Show escape
The hands of several VPS configuration iptables too cumbersome to see the Zhu Go lnmp script has an automatic configuration iptables firewall script, borrowed to change a bit, to the needs of the people;Only provide common port settings, if you have
A large number of files are required for testing, so a script is written to copy. A regular file name facilitates reference.
Copy Code code as follows:
#!/bin/sh
# file Name:batchcp.sh
# Author:zhouhh
#
This paper briefly introduces the method of Gearman using MySQL, and some problems caused by it, the detailed analysis is as follows:
First, Gearman create a MySQL persistence queue in the following ways:
1. Log into the MySQL command line and run:
With the need to monitor some of the Apache servers that require high availability, in addition to professional monitoring and alerting devices, it is a good idea to write a script that automatically monitors Apache status on the Apache server at
Copy Code code as follows:
#!/bin/bash
# march-13-2006# Cpuuse Trigger script by Noel## Bash code to watch a running program ' s CPU usage.# if it ' s above a set value, it'll auto send an email.# You'll need to set a Cron job to run this
Access parameters
You can visit the command-line argument via PROCESS.ARGV, which is an array containing the following:
[Nodebinary, Script, arg0, arg1, ...]
That is, the first argument starts with Process.argv[2], and you can iterate through all
The code is as follows:1#!/bin/SH2 #################################################################3 # Author:91coder4# blog:www.cnblogs.com/91coder5 #################################################################6 7 # Create a
A system that encounters a non-Dubbo framework in a project needs to dispatch the tasks of the Dubbo framework system.Tried the expect method, need to install TCL and expect Linux.First Dubbo The official documentation mentions the way Linux calls
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.