惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Y
Y Combinator Blog
Engineering at Meta
Engineering at Meta
D
Docker
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
腾讯CDC
P
Proofpoint News Feed
A
About on SuperTechFans
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
Google DeepMind News
Google DeepMind News
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
MyScale Blog
MyScale Blog
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
G
Google Developers Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - 海盗

How to point your package manager to US server How to install Java in Ubuntu HOWTO: Install chinese input One series article of Linux file system Reading notes of &lt;&gt; -- I <> - 海盗 - 博客园 Got two days' break New keyboard - 海盗 - 博客园 Some questions before learning ASP.net MVC framework Back again! JavaScript MD5 Encryption - 海盗 AJAX中的Back Button/Bookmarking问题和Nikhil Kothari的Atlas解决方案 My 50 favorite design resources 复杂域环境下通过.Net操作Active Directory经验点滴 IE ToolBar 关于C#中字段的初始化 关于namespace - 海盗 - 博客园 好久没来了! C#播放音乐
[Linux]Variable and Parameters in Bash - 海盗
海盗 · 2008-09-11 · via 博客园 - 海盗

The only time a variable appears "naked" -- without the $prefix -- is when declared or assigned, when unset, when exported, or in the special case of a variable representing a signal.

Double quotes ("...") does not interfere with variable substitution.

Single quotes('...') causes the variable name to be used literally, and no substitution will take place.

$variable is actually a simplified form of ${variable}

An uninitialized variable has  a "null" value. (In mathmetic , it is 0)

 = can be either an assignment or a test operator, depending on context.

$(...) mechanism: arch =$(uname -m)

Bash variables are character string, but depending on context, Bash permits integer operations and comparisons on variable. The determining factor is whether the value of a variable contains only digits.

 An script can export variables only to child processes.

Positional parameter: arguments passed to the script from the command line. $0, $1, $2 ... ${10}, ${11} 

 $0 is the name of the script itself. $1 is the first argument.

$* and $@ denote all the positional parameters.