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

推荐订阅源

量子位
Stack Overflow Blog
Stack Overflow Blog
人人都是产品经理
人人都是产品经理
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Y
Y Combinator Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
博客园 - 司徒正美
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
L
LangChain Blog

博客园 - 海盗

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.