Изменил(а) на 'shell/helpers.sh'

log() added
master
Anthony Axenov 2023-07-03 01:42:21 +00:00
parent 9cb6aee0c3
commit 566424b15b
1 changed files with 7 additions and 2 deletions

View File

@ -12,6 +12,11 @@
# Little handy helpers for scripting # Little handy helpers for scripting
###################################### ######################################
log() {
[ ! -d "/home/logs" ] && mkdir -p "/home/logs"
echo -e "[`date '+%H:%M:%S'`] $*" | tee -a "/home/logs/`date '+%Y%m%d'`.log"
}
installed() { installed() {
command -v "$1" >/dev/null 2>&1 command -v "$1" >/dev/null 2>&1
} }
@ -365,11 +370,11 @@ assert_code() {
# func1() { # func1() {
# # exit 0 # # exit 0
# return 0 # return 0
# } # }
# func2() { # func2() {
# # exit 1 # # exit 1
# return 1 # return 1
# } # }
# expect_code "func1" 0 # PASSED # expect_code "func1" 0 # PASSED
# expect_code "func1" 1 # FAILED # expect_code "func1" 1 # FAILED