Added build files to turn the bible into a book

This commit is contained in:
Dylan Araps
2018-06-20 12:40:31 +10:00
parent e0aadbde13
commit fe6e2cd195
21 changed files with 1310 additions and 1440 deletions

View File

@@ -1,51 +1,99 @@
# Obsolete Syntax
# Internal Variables
## Shebang
**NOTE**: This list does not include every internal variable (*You can
help by adding a missing entry!*).
Use `#!/usr/bin/env bash` instead of `#!/bin/bash`.
For a complete list, see:
http://tldp.org/LDP/abs/html/internalvariables.html
- The former searches the user's `PATH` to find the `bash` binary.
- The latter assumes it is always installed to `/bin/` which can cause issues.
## Get the location to the `bash` binary
```shell
# Right:
#!/usr/bin/env bash
# Wrong:
#!/bin/bash
"$BASH"
```
## Command Substitution
Use `$()` instead of `` ` ` ``.
## Get the version of the current running `bash` process
```shell
# Right.
var="$(command)"
# As a string.
"$BASH_VERSION"
# Wrong.
var=`command`
# $() can easily be nested whereas `` cannot.
var="$(command "$(command)")"
# As an array.
"${BASH_VERSINFO[@]}"
```
## Function Declaration
Don't use the `function` keyword, it reduces compatibility with older versions of `bash`.
## Open the user's preferred text editor
```shell
# Right.
do_something() {
# ...
}
"$EDITOR" "$file"
# Wrong.
function do_something() {
# ...
}
# NOTE: This variable may be empty, set a fallback value.
"${EDITOR:-vi}" "$file"
```
## Get the name of the current function
```shell
# Current function.
"${FUNCNAME[0]}"
# Parent function.
"${FUNCNAME[1]}"
# So on and so forth.
"${FUNCNAME[2]}"
"${FUNCNAME[3]}"
# All functions including parents.
"${FUNCNAME[@]}"
```
## Get the host-name of the system
```shell
"$HOSTNAME"
# NOTE: This variable may be empty.
# Optionally set a fallback to the hostname command.
"${HOSTNAME:-$(hostname)}"
```
## Get the architecture of the Operating System
```shell
"$HOSTTYPE"
```
## Get the name of the Operating System / Kernel
This can be used to add conditional support for different Operating
Systems without needing to call `uname`.
```shell
"$OSTYPE"
```
## Get the current working directory
This is an alternative to the `pwd` built-in.
```shell
"$PWD"
```
## Get the number of seconds the script has been running
```shell
"$SECONDS"
```
## Get a pseudorandom integer
Each time `$RANDOM` is used, a different integer between `0` and `32767` is returned. This variable should not be used for anything related to security (*this includes encryption keys etc*).
```shell
"$RANDOM"
```
<!-- CHAPTER END -->