Case statement in shell: It can match the variable content with multiple templates, and then decide which part of the Code should be executed based on the template that matches successfully. Format of www.2cto.com: case matching mother board in
In shell, the display format of commonly used date is as follows:
Date + % f // 2007-03-06Date + % Y % m % d // 20070306
Date + % t // 23:37:11
// YesterdayDate + % Y % m % d-d "-1 day"// TomorrowDate + % Y % m % d-d "+ 1 day"// Last monthDate + % Y
Location parameters
Internal Parameters
Just as the LS command can accept directories and other parameters as its parameters, parameters can also be used in shell programming. Parameters in Shell programs include location parameters and internal
Tlcl-view the world echo in shell eyes, tlcl-view echo
View the world in shell eyes
Echo-display a line of text
When you enter a command, bash expands the input characters before executing the command.
Expand path
Echo *
Shell expands * to the
Function description: starts or disables built-in shell commands. Syntax: enable [-n] [-all] [built-in commands] Supplement: if the name of the file to be executed is the same as that of the shell built-in commands, enable-n can be used to disable
I couldn't remember the title of the brackets in shell, so I got such a Inappropriate title.
Here I want to talk about the parentheses, braces, and variables in several shells. The Command usage is as follows:
PHP code:
1. $
2. $ (cmd)
3. () and {}
4
In shell, if is used to compare whether two strings are equal: www.2cto. comif [& quot; $ test & quot; x & quot; test & quot; x]; then has the following key points: 1. use a single equal sign 2 to notice that there is a space on both sides of the
The subscript of the array in shell is 1 starting from 0 by default. Put the string in the array and get its length #! /Bin/bashstr & quot; AB -- nd & quot; array ($ str) length $ {# array [@]} echo $ lengthfor (i0; I & lt; $ length; I ++) doecho $ {
Key points for using the find command in shell linux the find command is an important way to find files, and other bash commands can be used to achieve powerful operation results. Let's take a look at the basic components of the find command:
String truncation method in shell programming
String truncation method in shell programming:
1. the Gnu Linux shell intercepts the first eight characters of the character variable by using the following methods:
1. expr substr "$ a" 1 8
2. echo $ a |
Execute mysql statements in Shell scripts
For automated O & M, such as backup and recovery, DBA often needs to encapsulate SQL statements into shell scripts. This article describes several methods for calling SQL statements in a mysql database in a
echo Display in shell script with color display, echo display with color, need to use parameter-EThe format is as follows:For example:Where 41 of the position represents the background, 36 of the position is the color of the wordNote:1, the word
In shell script, $* and [email protected] Both get all command-line arguments, but there is a slight difference between the two in use, the difference is mainly in the use of double quotes, that is, the direct use of $*,[email protected], or use "$*"
Output colored text in the shell using the echo commandNameecho-Displays a line of textProfileecho [Options] ... [String] ...DescribeOutputs a string to the standard output.-N does not output line breaks-E Open backslash ESC escape-e Suppress
This blog post describes the common conditions and looping statements in shell scripts:Conditional statements:650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/06/B7/wKiom1m8ytPDGg7MAAB1t9_5n8Q866.png-wh_500x0-wm_ 3-wmp_4-s_2860871127.png "
The full syntax format for the Find command is as follows:find [path] [options] [tests] [actions]
PathThe path section is easy to understand: You can use either an absolute path, such as/bin, or a relative path, such as. 。 You can also specify
Conditional judgment statements are not necessary in any program writing, as is the case in shell programming, where the comparison operators that are often used in the shell's test commands are sorted into numeric comparisons, string comparisons,
This article mainly describes the Oracle-related commands commonly used in shell programming. 1. Sqlplus-l/-s ParametersSqlplus-l user/-S User/password #-s to set silent mode, commonly used2. Set related commandsset timing on #显示SQL语句的运行时间. The
Shell Script IntroductionShell is a scripting language blog.lishiming.net (Amin blog, you can go inside to find the shell problem)You can use logical judgments, loops, and other syntaxFunctions can be customized to reduce duplication of codeThe
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.