The shell determines the file type.-D file to determine whether the file exists, and whether it is a directory (the directory is true)-e file to determine whether the file exists (exists as true)-F file to determine whether the file exists , and
Shell scripting is one of the skills that Linux OPS engineers have to master, and the use of shell scripts allows us to better operate Linux systems and facilitate our execution.One, the basics of programmingBASIC Programming ConceptsProgramming
Shell variable shell supports three types of variables
User-defined variables: User-defined variables, variable names begin with an English letter or underscore, and are case-sensitive.
Positional variables: Variables that are passed to
The concept and characteristics of regular expressions
A regular expression is a logical formula for a string operation, which is to make a "rule string" with a predefined set of characters and a combination of those specific characters.This
A collection of shell backup scripts under LinuxWhen it comes to the shell we are not unfamiliar, the shell is Linux under the batch script, like the VBS script under Windows and so on, can help us to complete some automated tasks, we also
There are a number of ways to intercept strings in the shell, ${expression} There are 9 ways to use them. ${parameter:-word}${parameter:=word}${parameter:?word}${parameter:+word} The above 4 alternatives can be used for default values. ${#parameter}
1 Bash Information profile for the TTY login interface:/etc/issueLogon interface information for Telnet telnet:/etc/issue.net2/ETC/MOTD the contents of this file can be seen by all users including the root user when logging in, so when there is
Section one: Breank commands4 loops for, while, until, select, if you want to end the loop early, you can use the break command in the loop. When you perform a break, you jump out of a layer of loops, and if you want to jump out of a multilayer loop,
The usual way to write shell scripts is to use $1,$2 .... This way to receive parameters, however, this method of receiving parameters is not only easy to forget and not easy to understand and maintain. The commands that are commonly used by Linux
There are usually 3 ways to perform mathematical operations in the shell:Expr commandFor example, expr 1 + 6 will return 7, the disadvantage of using expr is to encounter multiplication, or parentheses (because they have other meanings in the shell),
We usually need to output a color font when we write a script, and now we can pass it. Color.sh to introduce this script directly, using the variables inside, so that we can reduce the amount of time we normally write
One, Shell scriptPre-placed in a file with a variety of commands to facilitate one-time execution of a program text; some shell syntax and instructions are written inside, and then the functions such as formal notation, pipeline commands, and data
Shell ScriptShell script: Always use, but no system to learn, just in the Linux command line mode to knock some simple common instructions, now the system to learn some.First, create a shell script, generally end with. SH (linux suffix is just a
The difference between the anti-quote and $ ():Let's first look at an example:Create a file named Test.sh, enter the following two instructions in the file650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/82/DB/wKioL1ditWDAq5FZAAAJ9atF8Qc539
Sometimes we need to look at the network card traffic on the server in real time, here I write a shell script. The script uses a while true "dead loop", every 10s from "/proc/net/dev" to take a value and calculates the average bandwidth within 10s
Shell scripts or function-passed arguments, you can access positional variables to use the values of the parameters. However, in the case of complex parameters, it is best to use getopts processing, which handles the command line options and
use these commands to do almost anything you want to do.
Command
Describe
Alias
Define an alias for the specified command
Bg
Run of later mode recovery jobs
Bind
Bind a
#break和continue命令: During a loop, sometimes you need to force the loop to break out when the loop end condition is not reached#break: Allow all loops to jump out (end all loops after execution)1 while: #死循环写法 #2 Do3 Echo-N"Input A number
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.