Linux Base-bash Command priority

Source: Internet
Author: User

I. Bash INTRODUCTION

The command interpreter, the Bourne Again shell, originates from the shell. Shell commonly known as shell, it refers to a UNIX system under a command parser, mainly for the user and system interaction. There are many kinds of shells on UNIX systems. The first shell, The Bourne Shell, was launched in 1978 at V7 (7th edition) Unix. Later, different versions of the shell, such as C shell, Bash, were evolved.

Bash is widely used in daily work due to its ease of use and free. At the same time, bash is the default shell for most Linux systems. In general, people do not differentiate between the Bourne shell and the Bourne Again shell, so, like #!/bin/sh, it can also be changed to #!/bin/bash. #! tells the system that the program specified after the path is the shell that interprets this script file.

Two. Priority of the command

1. Get the priority level of a command execution, up and down

Alias

Compound commands

function

Build_in

Hash

$PATH

Error:command not found

2. Classification of commands

Alias: is to simplify the integration of the output to a long parameter command, alias definition method aliases la= ' Ls-al ' de alias unalias la;

built_in (internal command): the command function of bash comes simple, the help of internal command is in BUILTIN (1);

External command: is a small program exists in/bin//sbin//usr/bin and other places.

3. Priority validation of commands

A authentication alias takes precedence over internal commands and external commands

 

  conclusion, command execution search order: aliases (alias can see)--bash internal Command--$PATH in each path separated by a colon to search
B Authentication aliases take precedence over compound commands (compound command)

C Verify that compound commands take precedence over functions (function)

d validation function takes precedence over built-in commands

  conclusion, the command executes the search order: alias (alias can be viewed)--compound command--function-- Bash Internal Command-- search $PATH in each path separated by a colon

E Verify that the hash takes precedence over $path

Final verification Conclusion: command execution Search order: alias (alias can be viewed)--compound command--function--built-in command--bash internal command--$PATH in each path separated by a colon to search

Resources

1. Http://www.cnblogs.com/linhaifeng/p/6592572.html#_labelTop

2. Http://www.cnblogs.com/skywang12345/archive/2013/05/30/3106570.html#a12

Linux Base-bash Command priority

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.