Reference: First, the user log into the system after the system environment variables:
$HOME user's own directory
$PATH directory to search for when executing commands
$TZ Time Zone
$MAILCHECK every few seconds to check for new letters
$PS 1 The
Often when writing a shell script, you will encounter a different user to execute the relevant commands, the way to simply note:
1. Execute a single command: su-user-c "command"
For example, the following command is to create a test123 directory
Recently do a group purchase file download service, their lazy do not want to write the logic of the file download, and Linux Curl command is very powerful, so want to directly through the Java to execute Curl command to do the download.
In Java,
No.1: Using expreg. R= ' Expr 4 + 5 'Echo $rNote : There should be a space between the operators and operands in the 4 + 5 expression
# finally found the reason, to force Ah.
In addition, for multiplication operator *, use expr needs to be added \
one echo command output text
1.1 displaying normal strings
echo [Options] string
option means that the command option, only-n, does not output a newline character at the end of the line.
If the text you want to output is made up of multiple
29th Chapter CGI Script
This chapter contains content:
Basic CGI Script
Using server-side embedding (server Side Includes,ssi)
Get method
Post method
Creating interactive scripts
Ability to automatically reload Web pages with CGI scripts
CGI is a
I use the Mac is when you start a Python port process, even if it is turned off, the background process is still present, the process of initiating the same port, or the error prompt has been occupiedWhen you lsof-i: the port number (linux--(SS-ANPT
1, you can consider/dev/null as a "black hole." It is very equivalent to a write-only file. All the content written to it is lost forever. and trying to read from it is nothing. However,/dev/null is very useful for command lines and scripts.
Words do not say much, directly on the format:function formats in the Linux shell:function Myfunc () {Action[Return int;]}Among them, the individual thinks function and () are all functions of the flag, if you do not need to pass parameters , choose
>Access to variables: EchoEcho $variableEcho $PATHEcho ${path}Configuration rules for variables1. Variables and variable contents are linked by an equal sign "=" as follows:"Myname=vbird"2. The equal sign cannot be directly connected to the space
In the previous command Ls/var then in this command LS is the command keyword,/var is the parameter. So how do we do parameter passing when we're making a shell script ourselves?In bash, the first parameter is automatically placed in $ $, the second
Parameter related knowledge${parameter:-word}: If parameter is empty or undefined, the variable is expanded to "word"; otherwise, the value of parameter is expanded; ${parameter:+word}: If parameter is empty or undefined, do nothing; otherwise,
Reference: Linux commands, editor and Shell programming, advanced Programming for UNIX environmentsBoth exec and source belong to the Bash Internal command (builtins commands), where you can view all the internal command information by entering man
8.6 Pipe break and job control pipe symbol "|"
The effect of a pipe character is to drop the result preceding the symbol to the command following the symbol. Not all commands are available after the pipe character, and generally commands
Special variables$ A: The file name of the current script$num: Num is a number starting from 1, and $ is the first argument, and $ is the second argument, ${10} is the tenth argument$#: Number of arguments passed in the script$*: All positional
Encounter shell script need to collect parameter scene, with Getopts very convenientgetopts optstring name [arg ...] Example: Getopts "A:fs" OPTIONCommand Description:optstring lists all the parameters that the corresponding shell script can
Shell basics 2: Search Skills, use of find and xargs
Execute shell commands using exec or OK When using find, you only need to write the desired operation in a file, you can use exec to search with find, which
Variable:
Local variable: valid only for the current
Environment variable: valid for both the current shell and sub-shell
Export A = 3 define a as a variable and assign 3 to
A = 3
Export a reference does not need to be added &
Export also views
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