Project

General

Profile

« Previous | Next » 

Revision 9109

lib/sh/util.sh: echo_run(): factored prep code out into echo_run_prep alias, which can also be used in commands that mimic it, such as limit_stderr_cmd()

View differences:

util.sh
189 189
	log "$*"
190 190
}
191 191

  
192
echo_run() { cmd2rel_path; echo_cmd "$@"; indent; "$@"; }
192
alias echo_run_prep='cmd2rel_path; echo_cmd "$@"; indent'
193 193

  
194
fi # load new aliases
195
if self_being_included; then
196

  
197
echo_run() { echo_run_prep; "$@"; }
198

  
194 199
# usage: ([stdout2stderr=1] limit_stderr; cmd...) || return
195 200
# `|| return` needed on Mac because of bug where -e doesn't apply to ()
196 201
function limit_stderr()
......
202 207

  
203 208
limit_stderr_cmd() # usage: [stdout2stderr=1] limit_stderr_cmd cmd...
204 209
{
205
	case "$1" in echo_run) shift; cmd2rel_path; echo_cmd "$@"; indent;; esac
210
	case "$1" in echo_run) shift; echo_run_prep;; esac
206 211
	(limit_stderr; "$@") || return
207 212
}
208 213
alias limit_stderr_cmd='limit_stderr_cmd ' # last space alias-expands next word

Also available in: Unified diff