Merge pull request #55 from Crestwave/varname
Add "Name a variable based on another variable" entry
This commit is contained in:
10
README.md
10
README.md
@@ -78,6 +78,7 @@ See something incorrectly described, buggy or outright wrong? Open an issue or s
|
|||||||
* [Get the base-name of a file path](#get-the-base-name-of-a-file-path)
|
* [Get the base-name of a file path](#get-the-base-name-of-a-file-path)
|
||||||
* [VARIABLES](#variables)
|
* [VARIABLES](#variables)
|
||||||
* [Assign and access a variable using a variable](#assign-and-access-a-variable-using-a-variable)
|
* [Assign and access a variable using a variable](#assign-and-access-a-variable-using-a-variable)
|
||||||
|
* [Name a variable based on another variable](#name-a-variable-based-on-another-variable)
|
||||||
* [ESCAPE SEQUENCES](#escape-sequences)
|
* [ESCAPE SEQUENCES](#escape-sequences)
|
||||||
* [Text Colors](#text-colors)
|
* [Text Colors](#text-colors)
|
||||||
* [Text Attributes](#text-attributes)
|
* [Text Attributes](#text-attributes)
|
||||||
@@ -1046,6 +1047,15 @@ $ printf '%s\n' "$ref"
|
|||||||
value
|
value
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Name a variable based on another variable
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ var="world"
|
||||||
|
$ declare hello_$var=value
|
||||||
|
$ printf '%s\n' "$hello_world"
|
||||||
|
value
|
||||||
|
```
|
||||||
|
|
||||||
<!-- CHAPTER END -->
|
<!-- CHAPTER END -->
|
||||||
|
|
||||||
<!-- CHAPTER START -->
|
<!-- CHAPTER START -->
|
||||||
|
|||||||
@@ -27,5 +27,14 @@ $ printf '%s\n' "$ref"
|
|||||||
value
|
value
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Name a variable based on another variable
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ var="world"
|
||||||
|
$ declare hello_$var=value
|
||||||
|
$ printf '%s\n' "$hello_world"
|
||||||
|
value
|
||||||
|
```
|
||||||
|
|
||||||
<!-- CHAPTER END -->
|
<!-- CHAPTER END -->
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user