diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-23 20:33:49 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-23 20:38:17 +1200 |
commit | 59b6046684dd405f60d2a164b93ba9c50f5e80c4 (patch) | |
tree | 8c6385a23d6d82e636e0632752620e8049be78dd /bash/bashrc.d/keep.bash | |
parent | Explicitly declare array to reassure shellcheck (diff) | |
download | dotfiles-59b6046684dd405f60d2a164b93ba9c50f5e80c4.tar.gz dotfiles-59b6046684dd405f60d2a164b93ba9c50f5e80c4.zip |
Fully expand FUNCNAME
Diffstat (limited to 'bash/bashrc.d/keep.bash')
-rw-r--r-- | bash/bashrc.d/keep.bash | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/bash/bashrc.d/keep.bash b/bash/bashrc.d/keep.bash index fb4b8bde..8f6a6fdb 100644 --- a/bash/bashrc.d/keep.bash +++ b/bash/bashrc.d/keep.bash @@ -46,18 +46,18 @@ keep() { # -h given; means show help h) cat <<EOF -$FUNCNAME: Keep variables and functions in shell permanently by writing them to +${FUNCNAME[0]}: Keep variables and functions in shell permanently by writing them to named scripts iterated on shell start, in \$BASHKEEP (defaults to ~/.bashkeep.d). USAGE: - $FUNCNAME + ${FUNCNAME[0]} List all the current kept variables and functions - $FUNCNAME NAME1 [NAME2 ...] + ${FUNCNAME[0]} NAME1 [NAME2 ...] Write the current definition for the given NAMEs to keep files - $FUNCNAME -d NAME1 [NAME2 ...] + ${FUNCNAME[0]} -d NAME1 [NAME2 ...] Delete the keep files for the given NAMEs - $FUNCNAME -h + ${FUNCNAME[0]} -h Show this help EOF @@ -67,7 +67,7 @@ EOF # Unknown other option \?) printf 'bash: %s -%s: invalid option\n' \ - "$FUNCNAME" "$opt" >&2 + "${FUNCNAME[0]}" "$opt" >&2 return 2 ;; esac @@ -92,7 +92,7 @@ EOF # characters besides letters, numbers, or underscores *[^a-zA-Z0-9_]*|[^a-zA-Z_]*) printf 'bash: %s: %s not a valid NAME\n' \ - "$FUNCNAME" "$name" >&2 + "${FUNCNAME[0]}" "$name" >&2 ((errors++)) ;; @@ -126,7 +126,7 @@ EOF # Deleting is an error, since we need at least one argument if ((delete)) ; then printf 'bash: %s: must specify at least one NAME to delete\n' - "$FUNCNAME" >&2 + "${FUNCNAME[0]}" >&2 return 2 fi |