Five week fourth lesson 8.6 pipe and job control 8.7/8.8 shell variable 8.9 environment variable configuration file

Source: Internet
Author: User


8.6 Pipe symbol and job control
8.7/8.8 Shell variables
8.9 environment variable configuration file

8.6 Pipe symbol and job control

1. Pipe Symbol | Pass the result of the preceding command to the following command
For example, # cat 1.txt |wc-l
or # cat 1.txt |grep ' aaa '-------|grep ' keywords ' filter specified keywords
2. Keyboard Ctrl + Z pause a task to do something else (return to the command screen)
How to return to the original task after pausing the task # FG Last Command # FG N---N represents the number (back to the foreground)
When there are two or more two pause tasks to use # jobs to view and then use # FG N to specify which task to open

3.# BG N Move the task to the background and run # FG to move the task to the foreground

4.# command to throw a command into the background to execute

8.7/8.8 Shell variables

Variables are the use of a simpler string instead of certain special-meaning settings and data
environment variable path, which is a variant of the shell preset, and usually the shell preset variables are uppercase

1.# Eva Use the ENV command to list all system variables for system presets
View variables after entering the EVA command
HOSTNAME: Indicates the name of the host
Shell: Represents the shell type of the current user
Histsize: Indicates the number of historical records
Mail: Indicates the current user's message store directory
PATH: The amount of change determines where the shell will look for commands or programs in those directories.
PWD: Indicates the current directory
LANG: This is a language-related environment variable that can be modified by a multi-locale environment
Home: Indicates the current user's home directory
LOGNAME: Indicates the login name of the current user



2.# sat not only can see the variables built into the system, but also can see the user-defined variables
such as the Shell script class

Custom variable # a=111 # echo $a
View variables can be set with # |grep 111 or # Set |less

3. Variable name rules often use variables when writing shell scripts
Can be a digital letter underline, but the first cannot be a number

4. When the value of a variable has a special symbol, it needs to be enclosed in single quotes.


5. Accumulation of variables

6. # export variable name = value of variable---------global variable
Note: After export declares variable A, it will only take effect for the shell's child shell or grandchild shell, but will not allow its parent shell and other terminal's shell to take effect

Echo $SSH _tty to see under which terminal


In Terminal 1 Customize an environment variable---------then # Bash


7. # unset variable name ---cancel variable

8.9 environment variable configuration file

Five week fourth lesson 8.6 pipe and job control 8.7/8.8 shell variable 8.9 environment variable configuration file

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.