From 59b6046684dd405f60d2a164b93ba9c50f5e80c4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 23 Aug 2016 20:33:49 +1200 Subject: Fully expand FUNCNAME --- bash/bashrc.d/keep.bash | 16 ++++++++-------- bash/bashrc.d/prompt.bash | 4 ++-- bash/bashrc.d/vared.bash | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'bash/bashrc.d') 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 <&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 -- cgit v1.2.3