1 |
8291
|
aaronmk
|
#!/bin/bash -e
|
2 |
8715
|
aaronmk
|
# runscripts: a bash-based replacement for make
|
3 |
8272
|
aaronmk
|
# unlike make, supports full bash functionality including multiline commands
|
4 |
|
|
# usage: path/to/dir/run cmd args
|
5 |
|
|
|
6 |
|
|
if false; then #### run script template:
|
7 |
8291
|
aaronmk
|
#!/bin/bash -e
|
8 |
8272
|
aaronmk
|
. "$(dirname "${BASH_SOURCE[0]}")"/path/to/util.run or file_including_util.run
|
9 |
|
|
. "$(dirname "${BASH_SOURCE[0]}")"/other_includes
|
10 |
|
|
|
11 |
|
|
cmd ()
|
12 |
|
|
{
|
13 |
8463
|
aaronmk
|
echo_func "$@"
|
14 |
8272
|
aaronmk
|
"$(dirname "${BASH_SOURCE[0]}")"/path_relative_to_self
|
15 |
|
|
"$(dirname "${BASH_SOURCE[1]}")"/path_relative_to_caller
|
16 |
|
|
"$top_dir"/path_relative_to_outermost_script
|
17 |
|
|
}
|
18 |
|
|
fi ####
|
19 |
|
|
|
20 |
8713
|
aaronmk
|
: "${verbosity=2}"
|
21 |
8710
|
aaronmk
|
|
22 |
8714
|
aaronmk
|
. "$(dirname "${BASH_SOURCE[0]}")"/util.sh
|
23 |
8703
|
aaronmk
|
|
24 |
8714
|
aaronmk
|
if self_not_included; then
|
25 |
8703
|
aaronmk
|
|
26 |
8464
|
aaronmk
|
# users can override this function to perform other commands (or no commands)
|
27 |
|
|
# after the script is read
|
28 |
8465
|
aaronmk
|
on_exit () { run_args_cmd; }
|
29 |
8464
|
aaronmk
|
trap on_exit EXIT
|
30 |
|
|
|
31 |
8704
|
aaronmk
|
fi
|