Revision 10271
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/runscripts/util.run | ||
---|---|---|
22 | 22 |
|
23 | 23 |
if self_not_included; then |
24 | 24 |
|
25 |
|
|
26 |
#### setup |
|
27 |
|
|
28 |
run_args_cmd() # runs the command line args command |
|
29 |
{ |
|
30 |
eval set -- "$(reverse "${BASH_ARGV[@]}")" |
|
31 |
test $# -ge 1 || set -- all |
|
32 |
echo_cmd "$top_script" "$@"; time "$@" |
|
33 |
} |
|
34 |
|
|
25 | 35 |
# users can override run_args_cmd to perform other commands (or no commands) |
26 | 36 |
# after the script is read |
27 | 37 |
on_exit() { test $? -eq 0 || return; run_args_cmd; } |
... | ... | |
36 | 46 |
} |
37 | 47 |
set_paths |
38 | 48 |
|
49 |
|
|
50 |
#### utils |
|
51 |
|
|
52 |
fwd() # usage: subdirs=(...); fwd "$FUNCNAME" "$@" |
|
53 |
{ |
|
54 |
echo_func |
|
55 |
: "${subdirs?}" |
|
56 |
|
|
57 |
for subdir in "${subdirs[@]}"; do "$top_dir"/"$subdir"/run "$@"; done |
|
58 |
} |
|
59 |
|
|
39 | 60 |
fi |
lib/sh/util.sh | ||
---|---|---|
860 | 860 |
function bg_cmd() { echo_func; "$@" & log_last_bg; } # usage: bg_cmd cmd... |
861 | 861 |
alias bg_cmd='"bg_cmd" ' # last space alias-expands next word |
862 | 862 |
|
863 |
run_args_cmd() # runs the command line args command |
|
864 |
{ |
|
865 |
eval set -- "$(reverse "${BASH_ARGV[@]}")" |
|
866 |
test $# -ge 1 || set -- all |
|
867 |
echo_cmd "$top_script" "$@"; time "$@" |
|
868 |
} |
|
869 | 863 |
|
870 |
fwd() # usage: subdirs=(...); fwd "$FUNCNAME" "$@" |
|
871 |
{ |
|
872 |
echo_func |
|
873 |
: "${subdirs?}" |
|
874 |
|
|
875 |
for subdir in "${subdirs[@]}"; do "$top_dir"/"$subdir"/run "$@"; done |
|
876 |
} |
|
877 |
|
|
878 |
|
|
879 | 864 |
#### filesystem |
880 | 865 |
|
881 | 866 |
alias mkdir='mkdir -p' |
Also available in: Unified diff
lib/sh/util.sh: moved runscript-related commands to lib/runscripts/util.run because these only apply to runscripts