The accumulation of some small knowledge of scripts in Linux

Source: Internet
Author: User

For a variable problem:

Assign a value to the variable, a= "Hello World", and now print the contents of variable A: echo $a.

For the use of ${}: Like $aall, we want $ A, which is, you can ${a}all.

For the difference between $ () and ${}: $ () is the result of executing the code inside, and ${} is the parameter, {} is to avoid the subsequent effects, such as the parameter ${a}a to be used in a coherent way. If you do not use {}, the system will be recognized as $AA.

$# 是传给脚本的参数个数

$0是脚本本身的名字

$1是传递给该shell脚本的第一个参数

$2是传递给该shell脚本的第二个参数

[email protected] 是传给脚本的所有参数的列表

$* 是以一个单字符串显示所有向脚本传递的参数,与位置变量不同,参数可超过9

$$ 是脚本运行的当前进程ID号

$? 是显示最后命令的退出状态,0表示没有错误,其他表示有错误

PWD command:

The accumulation of some small knowledge of scripts in Linux

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.