Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # Returns an eval-safe representation of the bash function that when evaluated prints its name,
- # useful when redefining functions
- function_copy_rnd () {
- local rand_prefix="$(head /dev/urandom | tr -dc A-Za-z | head -c 8)_"
- local name="$1"
- local decl;
- decl="$(declare -f "$name")" || return $?
- echo "${rand_prefix}${decl}; echo $(printf "%q" "${rand_prefix}${name}")"
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement