fix bugs in examples

This commit is contained in:
Dylan Araps
2018-06-14 18:05:47 +10:00
parent 8acd8fb2da
commit e156881d8c
2 changed files with 14 additions and 3 deletions

View File

@@ -4,4 +4,4 @@ os:
- linux - linux
script: script:
- shellcheck <(awk '/```sh/{f=1;next}/```/{f=0}f' README.md) - shellcheck -s bash --exclude=SC2034,SC2154 <(awk '/```sh/{f=1;next}/```/{f=0}f' README.md)

View File

@@ -185,7 +185,7 @@ printf '%s\n' "${!var2}"
# Assign to a variable named after the # Assign to a variable named after the
# value stored in '$var'. # value stored in '$var'.
var="test" var="test"
read -rp "input text: " "$var" read -rp "input text: " "${var?}"
# Access the variable indirectly. # Access the variable indirectly.
printf '%s\n' "set var \$$var to '${!var}'" printf '%s\n' "set var \$$var to '${!var}'"
@@ -649,7 +649,18 @@ http://tldp.org/LDP/abs/html/internalvariables.html
### Get the name of the current function. ### Get the name of the current function.
```sh ```sh
"$FUNCNAME" # 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. ### Get the host-name of the system.