If you manage a large number of sites and servers, it is quite painful to modify the configuration file every time. So I thought of using shell scripts to generate bulk configuration files and configuration data. The following script is a shell
1. Write the shell script, calculate 1-100 's and;#!/bin/bashsum=0;for((i=0;i100$sum$i ))}echo$sum2) Write the shell script, ask to enter a number, and then calculate from 1 to the input number and, if the input number is less than 1, then re-enter
Source:http://zhidao.baidu.com/question/322131711.htmlFile comparison Operators-e filename true if filename exists [-e/var/log/syslog]-D filename True if filename is a directory [-d/tmp/mydir]-F filename True if filename is a regular file
.: Denotes any character*: Matches the previous character, A * indicates: 0 or more A+: Matches the preceding character to represent 1 or more preceding characters?: matches the preceding character to represent 0 or more preceding characters#!
1.history Save History Command 1000, history-c empty;2.! String calls the most recently used command,! Vim's most recently used vim,! N calls the last Ming ' l,!242 that begins with N to invoke the No. 242 command in history.3.alias Rename, alias h5=
[Condition 1-a Condition 2] When 1 and 2 are true [condition 1-o condition 2] when 1 and 2 one is true [! condition] Take counter && and | | Or! unsigned [-D name] && Echo ' is dir ' is true when the name is directory, then the input has the
Sometimes a shell script is written to execute a sequence of programs. Some programs do not exit immediately after they are stopped, such as a tomcat hanging, even if the kill-9 command is not instantaneous.So if the shell does not wait for it to
1.Cut: Command Select cut-d ' delimited character '-F fields-D: followed by delimited characters, used with-f-F: Cutting a piece of information into several segments according to the delimited character of-D-C: Remove a fixed character range in
Shell Script (v)4. Sed and awk(1) SEDA, common parameters#文件编辑工具, text files and standard input can be edited, the standard input is keyboard input,#文件重定向, string, variable, and pipe text.#-n: Do not print all rows to standard output;-e: Resolves
$ who can know how many landings on the system$who |wc-l count the number of usersNote: | is a pipe symbol that can be used to establish a pipeline between two programs (pipeline): The WHO output, a WC input, the result of the WC is the number of
Http://c.biancheng.net/cpp/view/6998.htmlOpen a text editor, create a new file, the extension sh (sh for Shell), the extension does not affect the execution of the script, see the name is good, if you write a shell script in PHP, the extension is
More field servers, password 3 months expired, at the expiry of the need to change the password.Write with expect, try to log in 2 times after the exit (Prevent password error when the account lockout), time-out retry.The shell script calls and
SHELL script-1, shell-1
.: Represents any character
*: Matches the preceding character. a * Indicates zero or multiple.
+: Match with the previous character to indicate one or more previous characters.
? : Matches with the previous character to
Shell script to delete the folder N days ago ----- the difference between the date command on linux and mac
Background:Every day you build things and put them in different folders by date. For example, today's construction is put in, tomorrow's will
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.