0. IntroductionPrepare to open a new pit and update a shell practice every day. Because shell scripts belong to the kind of skills that are unfamiliar or even forgotten when you're not practicing, I can only keep on practicing in order to resist the
Shell Common Regular ExpressionsCommon Regular expression ^ # line Header locates $ # end of row. # match any character except line break * # match 0 or more repeating characters + # Repeat once or more? # repeat 0
11.1 Declare: Show or set shell variables
11.2 Export: Display or set environment variables
11.3 Set: Display and set shell variables
11.4 unset: Deleting a variable or function
11.5 env: Viewing and setting environment variables
1. Arithmetic operator: Native bash does not support simple math operations, but can be implemented with other commands, such as awk and expr,expr most commonly usedExpr is an expression evaluation tool that uses it to perform the evaluation of an
Exercise 1:Formatted outputRequirements: Enter a string of random numbers and then output by thousand. for example, the input number string is "123456789", the output is 123,456,789#/bin/bash# date:2018 March 15 read-p "Please input a long number:"
1. Record the command:!!! : Continuous "! "indicates that the last instruction was executed! N: Represents the second instruction in the execution of the command historyNote:! 2 actually shut me down.! String (string greater than 1) indicates the
Exercise 1:Statistics and summationRequirements: calculates the number of digits that appear in each row in document 1.txt and calculates a total of several numbers in the entire document.Reference Answer:#!/bin/bash# date:2018 March 6 sum=0for i in
The shell is the preferred system administrator for its stability, efficiency and flexibility.1. Shell Introduction:Command line: Refers to the interface for the user to enter a command, which itself simply accepts input and then passes the command
Transferred from: http://www.cnblogs.com/lishun1005/p/6054816.htmlIn view of debugging Logback and log4j file cutting has not been successful, with the shell to write a script to cut Tomcat under the log file (everyone if you have in Logback or
1.1Write a login welcome script(1a new script file, welcome.sh, is used to output various monitoring information. [[Email protected]~]#vi/root/welcome.sh#!/bin/bashEcho"Number of open processes: $ (PS aux | wc-l)"Echo"number of logged-in users: $
Exercise 1:Batch Change file nameRequirements:
Find all files with the suffix. txt in the/123 directory
Bulk Modify. txt to. txt.bak
Package all. bak files into 123.tar.gz
The name of the batch restore file, that is, to remove
Exercise 1: Generate a file every dayRequirements: please generate a daily file according to the date format (XXXX-XX-XX), for example, the file generated today is 2018-02-05.log, and write the disk usage to this file (do not consider Cron, just
BackgroundJenkins executes the shell command, which references some Jenkins variables, such as ${workspace}, because each execution of Jenkins is slow, so I want to copy the script to local debugging, directly copied the script to execute, the
Processing of strings1. Interception of stringsMethod one, using the ${} expressionFormat: ${var: Start position: Length}Phone= "13788768897" # echo ${#Phone} 11 When you use ${} to intercept a string, the
Vi. condition testing and selection 6.1 test expression-file Status Test6.1.1 [-E file]File exists with a value of true;file does not exist as false6.1.2 [-D file]File exists and is a directory with a value of true;file does not exist as false6.1.3 [
First, IntroductionIt is an executable file. Design executable statements in advance to accomplish specific tasks1.1 Common script typesBash ShellPython/perl/rubyjsp/php/asp/cgiJavascriptThe biggest advantage of 1.2 shell languageCan be fully
There are two types of data in the shell: one is a numeric type, the other is a string type , and although the shell itself is a weak type, it can be so distinguished.If we need to store multiple values in a variable in the shell, we need a more
An example of passing parameters in Shell programming and an example of shell Parameters
When executing a Shell script, we can pass parameters to the script. The parameter format obtained in the script is $ n. N indicates a number. 1 indicates the
Shell programming echo command usage instructions, shell programming echo command
Shell echo commands are similar to PHP echo commands and are used to output values. We can use echo to implement more complex output format control.Show normal
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