Project

General

Profile

« Previous | Next » 

Revision 9022

lib/sh/util.sh: added copy_func ()

View differences:

util.sh
43 43
unalias () { builtin unalias "$@" 2>&- || true; } # no error if undefined
44 44

  
45 45

  
46
#### functions
47

  
48
copy_func () # usage: from=... to=... copy_func
49
{
50
	: "${from:?}" "${to:?}"
51
	local from_def="$(declare -f "$from")"
52
	eval "$to${from_def#$from}"
53
}
54

  
55

  
46 56
#### exceptions
47 57

  
48 58
alias rethrow='return "$e"'

Also available in: Unified diff