docs: update

This commit is contained in:
Dylan Araps
2019-09-19 13:22:26 +03:00
parent ff056df3d1
commit 7d30736118

View File

@@ -32,6 +32,8 @@ align="center">A collection of pure POSIX sh alternatives to external processes.
* [Loop over a variable range of numbers](#loop-over-a-variable-range-of-numbers) * [Loop over a variable range of numbers](#loop-over-a-variable-range-of-numbers)
* [Loop over the contents of a file](#loop-over-the-contents-of-a-file) * [Loop over the contents of a file](#loop-over-the-contents-of-a-file)
* [Loop over files and directories](#loop-over-files-and-directories) * [Loop over files and directories](#loop-over-files-and-directories)
* [VARIABLES](#variables)
* [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)
@@ -559,6 +561,17 @@ for dir in ~/Downloads/*/; do
done done
``` ```
# VARIABLES
## Name a variable based on another variable
```shell
$ var="world"
$ export "hello_$var=value"
$ printf '%s\n' "$hello_world"
value
```
# ESCAPE SEQUENCES # ESCAPE SEQUENCES
Contrary to popular belief, there is no issue in utilizing raw escape sequences. Using `tput` abstracts the same ANSI sequences as if printed manually. Worse still, `tput` is not actually portable. There are a number of `tput` variants each with different commands and syntaxes (*try `tput setaf 3` on a FreeBSD system*). Raw sequences are fine. Contrary to popular belief, there is no issue in utilizing raw escape sequences. Using `tput` abstracts the same ANSI sequences as if printed manually. Worse still, `tput` is not actually portable. There are a number of `tput` variants each with different commands and syntaxes (*try `tput setaf 3` on a FreeBSD system*). Raw sequences are fine.