Grisson's .net

源码之前,了无秘密

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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.

 

posted on 2008-09-11 08:28  海盗  阅读(351)  评论(0编辑  收藏  举报