${varname:-word}If varname exists and is not nil, returns the value of VarName, otherwise returns word. This is commonly used to return a default value when VarName is undefined${varname:=word}If varname exists and is not nil, return the value of
Last Friday operations there was a excle for a mobile phone number, asking for information about all users that correspond to user numbers. This time encountered a problem is that you need to query the number of users, not one to check, and excle in
This is the age of big data!But have you ever thought of yourself as a bowl of big data? Chinese medicine said, talent is the most complex and the most magical natural products, first from the beginning to understand their own ...What do you think
It has long been assumed that the export-after variables in the shell script will affect the environment variables in the terminal that executes the shell. The concept of environment variables is not unique to the shell, but is owned by the process
Glob extensionIn the path extension in the shell, there are several glob involved:? Match any single character* Match 0 to more characters[Set] matches any one of the characters in the set, such as [0-9], matches any number[!set] matches any
Syntax format((expression))Expression can be any mathematical expression that can contain the following operators:+ Plus-Minus* Multiply (no escaping)/except% take-up* * Index= = equals! = Range> Greater than>= greater than or equal to&& Logic and||
Syntax formatIf Command;thenCommandsFiThe command contains the following:Shell commandAny shell command, if the shell command returns 0, represents true, otherwise, represents false. and multiple command can be used as the judgment condition of if,
Common options for Uniq commandsRemove Duplicate rows-U display non-repeating rows-D shows duplicate rows-C Print the number of repetitions per lineThe test text content is as follows:# Cat 4.txt11111122222222333333334444(1) Uniq# Cat 4.txt | Uniq
1.shell Script InterpreterBourme Shell (/usr/bin/sh or/bin//bin//usr/bin//usr/bin/ for Root (/sbin /SH)Bash is widely used in the development environment because it is easy to use and free2. First shell script#!/bin/"Hello World"#! is a contract tag
Code inside the monitoring 1 processes, the code is very simple, I do not explain, there is not understand, you can ask in reply.I saw it and gave it a lecture.Of course, the script to execute, you need to turn on the system's timer process Crond,
echo [options] [Output CONTENT]-E: Escape character that supports backslash controlExample: Echo-e "Hell\bo" → Output as "helo"Echo-e "\x68\t\x65\t\x6c\n\x6c\t\x6f\t" → output hello (with format)Echo-e "\e[1;34mthis is a blue\e[0m" → output blue
The For loop works by taking the element one by one of the serial element out, putting it into the set variable sequentially, and then repeating the enclosed command area (between do and done) until all the elements have been exhausted.Where serial
Syntax structure of case:Case to test item in style string 1] command area 1;;( Style string 2) command area 2;; Style string 3) command area 3;; *) command area;; Esac
Command area, can be a single instruction or multi-line instruction, but
1.declare commandDeclare declaring variable type: Declare [+/-][option] Variable name-: Set type attribute to variable+: Cancels the Type property of a variable-A: Declaring a variable as an array-I: Integer-X: Environment variables-R: Read-only
Expr can do the following:Logical operationsArg1 | Arg2 logic or operation, true return arg1, otherwise return arg2 (null or to determine the true and false parameters, there is a short-circuit function)Arg1 & arg2 Logic and operation, true return
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}
Environment variables
$HOME
Home directory of the current user
$PATH
A colon-delimited list of directories to search for commands
$PS 1
A command prompt, usually a $ character, but in bash,
Hkey_local_machine/software/microsoft/windows Nt/currentversion/winlogon/shell1) Windows Server 2012,minshell switch to Server Core:Open cmd-> Input "PowerShell", enter "uninstall-windowsfeature server-gui-mgmt-infra–restart" and wait for it to
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.