What is a Shell?Outline "Preface " 1. Shell Introduction 2, Bash function introduction 2.1. Record command history 2.2. Command and file name completion 2.3. Aliases2.4. pipe character/redirect 2.5. Shortcut keys 3. Bash
First, prefaceIn structured programming, there are three main structures: sequential, branching, and cyclic. This shows the importance of branch judgment.And in shell programming often encountered in the case of judgment, such as: Determine whether
Using Nginx as a load balancer, proxy Web server, the user requested data points to the Nginx load balancer, Nginx is responsible for scheduling the backend Web server to provide services.Environment Construction and Description:Nginx Load Balancer
S Shell Learning Note v1.0table of Contents
1. What's shell
2. Hello World Program
2.1. SRC
2.2. Add run Privilege
2.3. Run shell
3. variables in Shell
3.1. System
#!/bin/bashdeclare var="XXX" #without space and use one =#1.judge Whether the assignment statement returns trueEcho"----------------------test Assignment in bracket--------------------------------"[var="yyyy"] && Echo"Success"Echo"End" #Success["$
Ctrl+A-JumpTo the start of the lineCtrl+B-MoveBack aCharCtrl+C-TerminateThe commandIs it the most used?Ctrl+D-DeleteFromUnder the cursorCtrl+E-Jumpto theEndof the lineCtrl+F-MoveForward aCharCtrl+K-DeleteTo EOLCtrl+L-ClearThe screenClear screen,
The shell is a command interpreter that provides interaction between the user and the operating system for a non-interactive interface that is oriented to the command line. The user enters commands at the command line, the shell interprets them, and
Trap commandBasic format: Trap command SIG1 SIG2 ... signThere are 3 types of signals that can be captured:Exit: Exits from the function, or the entire script finishesERR: When a command returns a non-0 status code, the command execution is
One. Chown commandThe "chown" command changes the owner of the file and the user group. Each file belongs to one user group and one user. In your directory, use "Ls-l" and you will see something like this.[Email protected]:~# ls-lDrwxr-xr-x 3 server
$ represents the current process when using the Echo $$ is the PID that will output the current shell1 Echo $$
List of special variables
variables
meaning
$
File name of the current script
As Linux small white, only learn a little bit to remember:When deploying a server, it is often necessary to view the console output as if it were local, to be able to view log output overrides on Linux, and, of course, to have the logs displayed in
About redirectsAdditional redirection operatorsUse set-c collocation Posix shell : execute set -c command to open shell The so-called forbidden override option simple > redirect encountered when the destination file already exists
Case judgment in the shellFormat: Case variable name invalue1)Command;;value2)Command;;*)Commond;;EsacIn a case program, you can use a |, meaning, or means in a condition, such as:2|3)Command;;When the variable is 2 or 3 o'clock, the part of the
The simple use of the remote SCP file shell expect is implemented in shell scripts with expect http://myunix.blog.51cto.com/191254/1095074http:// Jie-hui-520.blog.163.com/blog/static/60074301201022610217249/linux rsync Synchronous Practice Http://my.
Forwarding: Linux Shell's && | | When the shell executes a command, it returns a return value that is saved in the shell variable $? In When $? = = 0 o'clock, indicating successful execution; = = 1 o'clock, which indicates that the execution
1. pwdPWD: Displays the absolute path of the current directory2. cdCD Document: Go to subdirectory cd/usr/local/lib: Go to the specific directory CD.: Return to Parent directory CD/: Return root directory3. mkdirmkdir directory: Creating
First, remove the number of occurrences of the shell in the/etc/passwd file: Here is a partial content of a/etc/passwd file. The topic asks to take out the shell and counts the number, the shell refers to the back/bin/bash,/sbin/nologin and so on,
Array:A collection of a bunch of variables.Statement:Declare-a ArraynnameEach of these variables is Arrayname[index]Index starts from 0.Assignment value:Arrayname[index] = VALUEArrayname = (VALUE1 VALUE2 ...)Arrayname = ([index1]=value1
/Etc/profile and/etc/bashrc, interactive and non-interactive, the difference between login and non-login shell, bashrcnon-loginThe online memcached crashes again and still does not get the core file. Check the cause and find that the script for
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