From 2a260f08e9b253c96f642d5cedf91a428f7ba295 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Wed, 26 Jan 2022 09:02:28 +0100 Subject: [PATCH] show errors on STDERR --- backup.sh | 4 ++-- jobhelper.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backup.sh b/backup.sh index e4bcfab..86f1ebd 100755 --- a/backup.sh +++ b/backup.sh @@ -91,7 +91,7 @@ do echo "Param: setting to AUTO on duplicity" echo "$2" | grep "^[1-9][0-9]*[a-zA-Z]$" 2>/dev/null if [ $? -ne 0 ]; then - echo "ERROR: the value after $1 must be a number and a letter (for unit); i.e. 1M for 1 month" + >&2 echo "ERROR: the value after $1 must be a number and a letter (for unit); i.e. 1M for 1 month" exit 1 else JOBDEF_TYPE=auto @@ -112,7 +112,7 @@ do bStart=1 ;; *) - echo "ERROR: parameter [$1] is unknown" + >&2 echo "ERROR: parameter [$1] is unknown" showHelp exit 1 esac diff --git a/jobhelper.sh b/jobhelper.sh index 1309257..1158e2c 100755 --- a/jobhelper.sh +++ b/jobhelper.sh @@ -47,7 +47,7 @@ function j_init(){ if [ ! -d "${DIR_JOBS}" ]; then # mkdir -p ${DIR_JOBS} && echo "INFO: dir created ${DIR_JOBS}" - echo "ERROR: missing jobs directory. Aborting." + >&2 echo "ERROR: missing jobs directory. Aborting." exit 1 fi @@ -169,7 +169,7 @@ function j_getSafename(){ # ------------------------------------------------------------ function _j_getvar(){ if [ ! -r "${1}" ]; then - echo "ERROR: cannot read file: ${1}. Abort." + >&2 echo "ERROR: cannot read file: ${1}. Abort." exit 100 fi grep "^${2}\ =\ " < "${1}"| cut -f 3- -d " " @@ -373,7 +373,7 @@ function j_requireProcess(){ function j_requireUser(){ sUser=$(id | cut -f 2 -d "(" | cut -f 1 -d ")") if [[ "$sUser" != "$1" ]]; then - echo "ERROR: user $1 is reqired." + >&2 echo "ERROR: user $1 is reqired." exit 5 fi } -- GitLab