IMP(shellcheck): replace ! -z by -n (SC2236)

This commit is contained in:
Thibault Ayanides
2020-12-04 15:14:18 +01:00
parent eaf56ca25e
commit d371b8d057
14 changed files with 29 additions and 30 deletions

View File

@ -23,7 +23,7 @@ audit() {
info "Checking if there are sgid files"
FS_NAMES=$(df --local -P | awk '{ if (NR!=1) print $6 }')
# shellcheck disable=2086
if [ ! -z $IGNORED_PATH ]; then
if [ -n "$IGNORED_PATH" ]; then
FOUND_BINARIES=$($SUDO_CMD find $FS_NAMES -xdev -type f -perm -2000 -regextype 'egrep' ! -regex "$IGNORED_PATH" -print)
else
FOUND_BINARIES=$($SUDO_CMD find $FS_NAMES -xdev -type f -perm -2000 -print)
@ -36,7 +36,7 @@ audit() {
BAD_BINARIES="$BAD_BINARIES $BINARY"
fi
done
if [ ! -z "$BAD_BINARIES" ]; then
if [ -n "$BAD_BINARIES" ]; then
crit "Some sgid files are present"
FORMATTED_RESULT=$(sed "s/ /\n/g" <<<"$BAD_BINARIES" | sort | uniq | tr '\n' ' ')
crit "$FORMATTED_RESULT"