aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-23 20:33:49 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-23 20:38:17 +1200
commit59b6046684dd405f60d2a164b93ba9c50f5e80c4 (patch)
tree8c6385a23d6d82e636e0632752620e8049be78dd
parent86c56cb8fb1c0ab723cb79652f8e750c79006426 (diff)
downloaddotfiles-59b6046684dd405f60d2a164b93ba9c50f5e80c4.tar.gz
dotfiles-59b6046684dd405f60d2a164b93ba9c50f5e80c4.zip
Fully expand FUNCNAME
-rw-r--r--bash/bashrc.d/keep.bash16
-rw-r--r--bash/bashrc.d/prompt.bash4
-rw-r--r--bash/bashrc.d/vared.bash4
3 files changed, 12 insertions, 12 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
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index ff8e4727..1a7a1c6f 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -81,7 +81,7 @@ prompt() {
PS1='\['"$format"'\]'"$PS1"'\['"$reset"'\] '
PS2='> '
PS3='? '
- PS4='+<$?> ${BASH_SOURCE:-$BASH}:$FUNCNAME:$LINENO:'
+ PS4='+<$?> ${BASH_SOURCE:-$BASH}:${FUNCNAME[0]}:$LINENO:'
;;
# Revert to simple inexpensive prompts
@@ -226,7 +226,7 @@ prompt() {
# Print error
*)
- printf '%s: Unknown command %s\n' "$FUNCNAME" "$1" >&2
+ printf '%s: Unknown command %s\n' "${FUNCNAME[0]}" "$1" >&2
return 2
;;
esac
diff --git a/bash/bashrc.d/vared.bash b/bash/bashrc.d/vared.bash
index 66250a3f..14958ffb 100644
--- a/bash/bashrc.d/vared.bash
+++ b/bash/bashrc.d/vared.bash
@@ -12,7 +12,7 @@ vared() {
;;
\?)
printf 'bash: %s: -%s: invalid option\n'
- "$FUNCNAME" "$opt" >&2
+ "${FUNCNAME[0]}" "$opt" >&2
return 2
;;
esac
@@ -20,7 +20,7 @@ vared() {
shift "$((OPTIND-1))"
if ! (($#)) ; then
printf 'bash: %s: No variable names given\n' \
- "$FUNCNAME" >&2
+ "${FUNCNAME[0]}" >&2
return 2
fi
local name