Add recommendation about typeset -g
parent
6f016a73cd
commit
805d81a949
1 changed files with 4 additions and 0 deletions
|
@ -32,6 +32,10 @@ Use existing variables whenever possible:
|
||||||
* Good: `${PWD}` `${USER}`
|
* Good: `${PWD}` `${USER}`
|
||||||
* Bad: `$(pwd)` `$(whoami)`
|
* Bad: `$(pwd)` `$(whoami)`
|
||||||
|
|
||||||
|
When declaring a global variable, be explicit and do it using `typeset -g`. This avoids warnings when `WARN_CREATE_GLOBAL` is set:
|
||||||
|
* Good: `if (( ! ${+VAR} )) typeset -g VAR=1`
|
||||||
|
* Bad: `: ${VAR=1}`
|
||||||
|
|
||||||
Flow logic
|
Flow logic
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue