Revision 9620
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
627 | 627 |
|
628 | 628 |
#### commands |
629 | 629 |
|
630 |
already_exists_msg() # usage: cond || what=... already_exists_msg || return 0 |
|
631 |
{ type=info die "$what already exists, skipping"; } |
|
632 |
|
|
630 | 633 |
require_not_exists() # usage: require_not_exists file || return 0 |
631 |
{ test ! -e "$1" || type=info die "file "$1" already exists, skipping"; }
|
|
634 |
{ test ! -e "$1" || what="file \"$1\"" already_exists_msg; }
|
|
632 | 635 |
|
633 | 636 |
function to_file() # usage: stdout=... [if_not_exists=1] to_file cmd... |
634 | 637 |
# auto-removes a command's output file on error (like make's .DELETE_ON_ERROR) |
Also available in: Unified diff
lib/sh/util.sh: added already_exists_msg() and use it instead of manually generating the die() call