Dynamic variable naming magic
This commit is contained in:
committed by
FriendlyNeighborhoodShane
parent
70f410ebb2
commit
9bcd730b6f
@@ -677,12 +677,12 @@ done
|
|||||||
|
|
||||||
# VARIABLES
|
# VARIABLES
|
||||||
|
|
||||||
## Name a variable based on another variable
|
## Name and access a variable based on another variable
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ var="world"
|
$ var="world"
|
||||||
$ export "hello_$var=value"
|
$ eval "hello_$var=value"
|
||||||
$ printf '%s\n' "$hello_world"
|
$ eval printf '%s\n' "\$hello_$var"
|
||||||
value
|
value
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user