# From https://stackoverflow.com/a/18839557
copy_function() {
- test -n "$(declare -f "$1")" || return
- eval "${_/$1/$2}"
+ test -n "$(declare -f "$1")" || return
+ eval "${_/$1/$2}"
}
rename_function() {
- copy_function "$@" || return
- unset -f "$1"
+ copy_function "$@" || return
+ unset -f "$1"
}
rename_function X _non_bash_X