Add error messages to quiet commands

This commit is contained in:
Augusto Gunsch 2021-08-10 10:29:03 -03:00
parent 315c829e70
commit f8353f68c1
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 9 additions and 3 deletions

View File

@ -11,13 +11,19 @@ qpopd() {
quiet() {
local DUMMY
set +e
DUMMY=$($@ 2>&1 > /dev/null)
if [ $? -ne 0 ]; then
echo "$DUMMY"
set -e
return 1
fi
set -e
}
testif() {
set +e
quiet $@
set -e
local DUMMY
DUMMY=$($@ 2>&1 > /dev/null)
}