Linux shell environment and shell scripts

Source: Internet
Author: User

1. "" "" "The Difference," "The variables will be resolved" "All of them as strings" "to execute system commands

2. The custom variable defaults to a local variable, and the environment variable is a global variable.

3.export can set one or more variables as global variables

4. To use a variable in a child shell in the parent shell, you must set the variable to global with export

5. Commonly used environment variables

6. User work environment, one is the system environment settings file, one is the personal environment settings file. The user working environment settings file in the system has (1) Login environment settings file:/etc/profile (2) Non-logon environment settings:/ETC/BASHRC

User-Set environment settings file, login environment settings file $home/.bash_profile environment settings file: $HOME/.BASHRC. The system environment settings file takes effect for all users, and the user environment settings file only takes effect for the specified user.

The lock in the 7.Shell script contains annotations, commands, shell variables, and structure control statements

8. Method of executing shell script (1) $bash script_file (2) chmod u+x script_file script_file

9 when executing a script, the shell produces a child shell to execute the file.

At the beginning of the 10.sShell script, #!/bin/bash tells the system what interpreter to use to execute the script

11 Variable substitution extension

${var-default} If Var is not declared, use default as its value

${var:-default} How Var is not declared or empty, its value is default

${var=default} with ${var-default}

${var:=default} with ${var:-default}

${var+other} If Var is declared, the value is other, otherwise null

${var:+other} If Var is declared or not NULL, the value is other

${!varprefix*} matches all variables preceded by varprefix

${!varprefix*} with ${!varprefix*}

12. String manipulation of variables

13.Shell numerical calculation symbol ((...))

14.read [parameter] [< variable name ...] Read is a query that pops up in the shell and saves the answer in the specified variable. -P SET Hint info-t set input wait seconds

15. Conditional testing, Bash allows multiple commands to be executed on a single command line, and each command,&& before the name executes successfully before executing the following command, | | The previous command execution failed with the following command.

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.