From 566424b15b1fecfd529591ba73c8abdf494834ea Mon Sep 17 00:00:00 2001 From: Anthony Axenov Date: Mon, 3 Jul 2023 01:42:21 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'shell/helpers.sh'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit log() added --- shell/helpers.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shell/helpers.sh b/shell/helpers.sh index 17538d5..4f4bc4b 100644 --- a/shell/helpers.sh +++ b/shell/helpers.sh @@ -12,6 +12,11 @@ # 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() { command -v "$1" >/dev/null 2>&1 } @@ -365,11 +370,11 @@ assert_code() { # func1() { # # exit 0 - # return 0 + # return 0 # } # func2() { # # exit 1 - # return 1 + # return 1 # } # expect_code "func1" 0 # PASSED # expect_code "func1" 1 # FAILED