Shell environment variables & parameter variables

Source: Internet
Author: User

Environment variables
$HOME Home directory of the current user
$PATH A colon-delimited list of directories to search for commands
$PS 1 A command prompt, usually a $ character, but in bash, you can use some more complex values. For example, the string [\[email protected]\h \w]$ is a popular default value that gives the user name, machine name, and current directory name, as well as a $ prompt.
$SP 2 A second-level prompt that prompts for subsequent input, usually the > character
$IFS Enter a domain prompt. When the shell reads the input, it gives a set of characters used to separate the words, usually space-time grids, tabs, and line breaks
$ The name of the shell script
$# The number of arguments passed to the script
$$ The process number of the shell script, which is typically used by the script to generate a unique temporary file, such as/tmp/tmpfileshell

Parameter variables
$1,$2,... Parameters of the script program
$* All parameters are listed in a variable, separated by the first character in the environment variable ifs, and the delimited character changes if the IFS is modified
[Email protected] It is an ingenious variant of $* that does not use IFS environment variables, so even if IFS is empty, the parameters will not be squeezed together

Shell environment variables & parameter variables

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.