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

推荐订阅源

博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog
博客园 - Franky
IT之家
IT之家
V
Visual Studio Blog
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
爱范儿
爱范儿
Hugging Face - Blog
Hugging Face - Blog
宝玉的分享
宝玉的分享
博客园 - 叶小钗
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
罗磊的独立博客
小众软件
小众软件
Jina AI
Jina AI

博客园 - 海盗

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.