Project

General

Profile

« Previous | Next » 

Revision 13232

lib/sh/util.sh: debugging: use configurable debug_fd (set to $err_fd)

View differences:

util.sh
66 66
function echo_vars() { :; }
67 67

  
68 68

  
69
#### errors
70

  
71
err_fd=2 # stderr
72

  
73

  
69 74
#### debugging
70 75

  
71
ps() { echo "$@" >&2; } # usage: ps str...
76
debug_fd="$err_fd"
72 77

  
73
pv() { declare -p "$@" >&2; } # usage: pv var... # debug-prints vars
78
ps() { echo "$@" >&"$debug_fd"; } # usage: ps str...
74 79

  
75
pf() { declare -f "$@" >&2; } # usage: pf function... # debug-prints func decls
80
pv() { declare -p "$@" >&"$debug_fd"; } # usage: pv var... # debug-prints vars
76 81

  
82
pf() { declare -f "$@" >&"$debug_fd"; } # usage: pf func... # prints func decls
77 83

  
84

  
78 85
#### logic
79 86

  
80 87
not() { ! "$@"; } # usage: wrapper_cmd not wrapped_cmd... # inverts exit status
......
475 482
#### verbose output
476 483

  
477 484

  
478
err_fd=2 # stderr
479

  
480 485
usage() { echo "Usage: $1" >&2; return 2; }
481 486

  
482 487

  

Also available in: Unified diff