Added build files to turn the bible into a book
This commit is contained in:
@@ -1,17 +1,57 @@
|
||||
# Variables
|
||||
# Escape Sequences
|
||||
|
||||
## Assign and access a variable using a variable
|
||||
Contrary to popular belief, there's no issue in using raw escape sequences. Using `tput` just abstracts the same ANSI escape sequences. What's worse is that `tput` isn't actually portable, there are a number of different `tput` variants on different Operating Systems each with different commands (*try and run `tput setaf 3` on a FreeBSD system*). The easiest solution ends up being raw ANSI sequences.
|
||||
|
||||
```shell
|
||||
hello_world="test"
|
||||
## Text Colors
|
||||
|
||||
# Create the variable name.
|
||||
var1="world"
|
||||
var2="hello_${var1}"
|
||||
**NOTE:** Sequences requiring RGB values only work in True-Color Terminal Emulators.
|
||||
|
||||
| Sequence | What does it do? | Value |
|
||||
| -------- | ---------------- | ----- |
|
||||
| `\e[38;5;<NUM>m` | Set text foreground color. | `0-255`
|
||||
| `\e[48;5;<NUM>m` | Set text background color. | `0-255`
|
||||
| `\e[38;2;<R>;<G>;<B>m` | Set text foreground color to RGB color. | `R`, `G`, `B`
|
||||
| `\e[48;2;<R>;<G>;<B>m` | Set text background color to RGB color. | `R`, `G`, `B`
|
||||
|
||||
## Text Attributes
|
||||
|
||||
| Sequence | What does it do? |
|
||||
| -------- | ---------------- |
|
||||
| `\e[m` | Reset text formatting and colors.
|
||||
| `\e[1m` | Bold text. |
|
||||
| `\e[2m` | Faint text. |
|
||||
| `\e[3m` | Italic text. |
|
||||
| `\e[4m` | Underline text. |
|
||||
| `\e[5m` | Slow blink. |
|
||||
| `\e[7m` | Swap foreground and background colors. |
|
||||
|
||||
|
||||
## Cursor Movement
|
||||
|
||||
| Sequence | What does it do? | Value |
|
||||
| -------- | ---------------- | ----- |
|
||||
| `\e[<LINE>;<COLUMN>H` | Move cursor to absolute position. | `line`, `column`
|
||||
| `\e[H` | Move cursor to home position (`0,0`). |
|
||||
| `\e[<NUM>A` | Move cursor up N lines. | `num`
|
||||
| `\e[<NUM>B` | Move cursor down N lines. | `num`
|
||||
| `\e[<NUM>C` | Move cursor right N columns. | `num`
|
||||
| `\e[<NUM>D` | Move cursor left N columns. | `num`
|
||||
| `\e[s` | Save cursor position. |
|
||||
| `\e[u` | Restore cursor position. |
|
||||
|
||||
|
||||
## Erasing Text
|
||||
|
||||
| Sequence | What does it do? |
|
||||
| -------- | ---------------- |
|
||||
| `\e[K` | Erase from cursor position to end of line.
|
||||
| `\e[1K` | Erase from cursor position to start of line.
|
||||
| `\e[2K` | Erase the entire current line.
|
||||
| `\e[J` | Erase from the current line to the bottom of the screen.
|
||||
| `\e[1J` | Erase from the current line to the top of the screen.
|
||||
| `\e[2J` | Clear the screen.
|
||||
| `\e[2J\e[H` | Clear the screen and move cursor to `0,0`.
|
||||
|
||||
# Print the value of the variable name stored in 'hello_$var1'.
|
||||
printf '%s\n' "${!var2}"
|
||||
```
|
||||
|
||||
<!-- CHAPTER END -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user