1
0
Fork 0
mirror of synced 2024-11-22 07:25:33 -05:00

Add recommendation about typeset -g

Eric Nielsen 2021-08-31 18:58:03 -05:00
parent 6f016a73cd
commit 805d81a949

@ -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
---------- ----------