diff --git a/.travis.yml b/.travis.yml index c3d52bf..64e1c52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,4 @@ os: - linux 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) diff --git a/README.md b/README.md index 5787656..d9e4a04 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ printf '%s\n' "${!var2}" # Assign to a variable named after the # value stored in '$var'. var="test" -read -rp "input text: " "$var" +read -rp "input text: " "${var?}" # Access the variable indirectly. 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. ```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.