Project

General

Profile

« Previous | Next » 

Revision 9023

lib/sh/util.sh: moved copy_func () after exceptions so it can use save_e/rethrow

View differences:

lib/sh/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

  
56 46
#### exceptions
57 47

  
58 48
alias rethrow='return "$e"'
......
91 81
if self_being_included; then
92 82

  
93 83

  
84
#### functions
85

  
86
copy_func () # usage: from=... to=... copy_func
87
{
88
	: "${from:?}" "${to:?}"
89
	local from_def="$(declare -f "$from")"
90
	eval "$to${from_def#$from}"
91
}
92

  
93

  
94 94
#### integers
95 95

  
96 96
let () { builtin let "$@" || true; }

Also available in: Unified diff