Linux System Shell Brief

Source: Internet
Author: User
Tags builtin nameserver

1 , describes the operation principle of shell program (can be attached with necessary graphical description);

What is a shell?

The shell acts as the shell of the operating system, providing the user with an interface to use the operating system. It is a general designation of command Languages, command interpreters, and programming languages.

650) this.width=650; "title=" clip_image001 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px, "border=" 0 "alt=" clip_ image001 "src=" http://s3.51cto.com/wyfs02/M01/73/64/wKioL1X787mQFmKyAAB6YUrtQyc622.jpg "height=" 399 "/>

Shell type GUI: Graphical user interface (Graphical user interface, abbreviated as  gui, also known as graphical user interface) refers to a graphical display of the computer operating user interface. including Kde,gnome. CLI:CLI (command-line interface, command line interface) refers to the interface that can type executable instructions at the user prompt, it usually does not support the mouse, the user through the keyboard input instruction, the computer receives the instruction, executes. including BASH,SH,CSH. /etc/shells holds all the shell    [[email protected] ~]# cat /etc/shells supported by the system     /bin/sh    /bin/bash    /sbin/nologin     /bin/dash    /bin/tcsh    /bin/cshecho  $SHELL   Show default shell    [[email protected] ~]# echo  $SHELL      /bin/bash    [ro[email protected] ~] #词法分析:  command, options, parameters built-in command: System comes with commands, You can use Type + commond to view the types of commands such as:    [[email protected] ~]# type  cd    cd is a shell builtin    [[email  Protected] ~]# tyPe echo    echo is a shell builtin    [[email  protected] ~]# type history    history is a shell  builtin external commands: Provided by the application, you can use Type + commond to view the types of commands such as:     [[email protected]  ~]# type vim    vim is /usr/bin/vim    [[ Email protected] ~]# type netstat    netstat is /bin/netstat     [[email protected] ~]# type ip    ip is  /SBIN/IP script execution:     compile execution: preprocessing-"compile-" compilation-"link-" Generate Binary Program Files      Explanation execution: The interpreter participates in the whole operation, reads one line and runs a line. Programs: Instruction + data      process programming: command-centric, design algorithms, data Services for algorithmic      object-oriented programming: Data-centric, design- Program services to data structure bash for procedural programming:     sequential execution: Execute      Select execution: Execute one of the branches (if)       Loop Execution:A piece of code executes 0 or multivariable (for)      variable: By assigning a string to another meaning, for example: Give the string "City" a value named "Beijing", which can be echo $ City's way of showing "city" is another "meaning" represented by this string.     [[email protected] ~]# city= "Beijing"     [[email  protected] ~]# echo  $city     beijingbash Variable: local variable: current shell available Using the Bash command to open a child shell when running the echo  $city, you will see a blank line, because the variable "city" cannot be displayed in the child shell as a local variable.     [[email protected] ~]# echo  $city     beijing     [[email protected] ~]# bash    [[email  protected] ~]# echo  $city     [[email protected] ~]#     city=beijingcity: variable name, can only contain numbers, characters and down lines, cannot start with a number =: assignment symbol beijing : Value reference variable: available through ${name}, $ The name method references the weak reference: "", the internal variable reference is replaced with the variable value     [[email protected] ~]# city=beijing     [[email protected] ~]# echo  "$city"     beijing Strong reference: ", the internal variable reference preserves the original character formatting     [[email  protected] ~]# city=beijing    [[email protected] ~]# echo   ' $city '      $city Command reference: ' Command ',  $ (command), the execution result of the reference     [[ email protected] ~]# city=$ (cat /etc/resolv.conf)     [[email  protected] ~]# echo  $city     ; generated by /sbin/ Dhclient-script search localdomain nameserver 192.168.111.2    [[email  protected] ~]# city= ' cat /etc/resolv.conf '     [[email protected]  ~]# echo  $city     ; generated by /sbin/dhclient-script  search localdomain nameserver 192.168.111.2 because the default save type for bash is character type, if you want to save as a value, you need to use a command declaration to save the type     declare  –i name[=value]    let name=value use the SET command to view all variables     [[email  protected] ~]# set    bash=/bin/bash    bash_aliases= ( )     bash_argc= ()     bash_argv= ()     bash_cmds= ()     bash_lineno= ()     bash_source= ()     bash_ versinfo= ([0]= "4"  [1]= "1"  [2]= "2"  [3]= "1"  [4]= "release" Environment variable: available for the current shell and its child shells ; Use the export command to change city to an environment variable, run echo  after opening a new child shell $city will find that the variable value can be displayed     [[email protected]  ~]# echo  $city     beijing    [[email protected]  ~]# export city    [[email protected] ~]# echo  $city     beijing    [[email protected] ~]# bash     [[email protected] ~]# echo  $city     beijing    [[email protected]  ~]#     Create an environment variable using the following commands     export name[=value]     declare –x name[=value]     destroying variable:    unset  name     Local variables: a function execution procedure, I will not demonstrate how to implement positional parameter variables: Reference the arguments passed to the script in the script, reference the arguments passed to the function in the function, and the first argument $2,$3 in turn. Special variables:     $?: Display the status of the command results 0 for success, 1-255 for failure     $#:  passed to script or function number of parameters      $* and [email protected]: The argument list passed to the script     $$: pid    that represents the command used  $0: Execute script name      variable type:     value: integer and floating point number      Characters: ASCII   (default storage mechanism for bash) bash variable usage characteristics: weak type, without prior declaration


Linux System Shell Brief

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.