Linux distributions standard shell: BASH software usage instructions, distributionsbash

Source: Internet
Author: User
Tags echo display

Linux distributions standard shell: BASH software usage instructions, distributionsbash

BASH is one of the most important tools and software in the GNU program. It is also the standard shell for Linux distributions. Bash has the following functions:

Command editing capability (history): records the commands used and stores them in the directory. bash_history. You can use the up and down keys to find the commands you have entered. Command alias setting function (alias): use aliases to replace other commands, such as alias lm = 'LS-al' job control and foreground background control stylized scripts (shell scripts)

Type to check whether the command is a built-in bash shell command

Type name

If no option parameter is added, type indicates whether the name command is an external command or a bash built-in command.

Use of shell function echo Function

Echo DISPLAY variable

Add $ before the variable name. For more echo functions, Run man echo.

For example, the Environment Variable HOME is displayed.

Echo $ HOME

In bash, when the variable name is not set, the result is not displayed.

-E indicates that escape is enabled. the following commands in the string have special meanings.

\ N line feed, move the cursor to the beginning of the line \ t Insert tab \ f line feed, but the cursor stays at the original position \ a sends a warning

Variable setting and Modification

Use = to set the variable. = no space is allowed on both sides. The variable name can only contain English letters and numbers, but cannot start with a number. Use unset to cancel variable settings. If you want to execute it in a subroutine, the export must be an environment variable. Command: The export PATH variable has blank characters, which use double quotation marks (") or single quotation marks ("). However, special characters (such as $) in double quotation marks keep their original features, special characters in single quotes can only use the \ next line for general characters. when extending the variable content, use the following method. For example, PATH = "$ PATH":/home/bin

You can use variable definitions to simplify directories. For example

Work = "/home/xinming/code /"

Cd $ work

Read, variable reading

Read reads the variables from the keyboard.

Read [-pt] variable

Meaning of option parameters:

-P: the content that can be followed by the prompt-t: the number of seconds that can be followed by the waiting time (if the specified number of seconds does not have any action, it will be skipped automatically)

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.