IMP(shellcheck): quote variables (SC2086)

This commit is contained in:
Thibault Ayanides
2020-12-07 16:49:11 +01:00
parent e2f7426664
commit 6826f377e6
68 changed files with 294 additions and 294 deletions

View File

@ -23,14 +23,14 @@ ERRORS=0
audit() {
for DIR in $(get_db passwd | egrep -v '(root|halt|sync|shutdown)' | awk -F: '($7 != "/usr/sbin/nologin" && $7 != "/bin/false" && $7 !="/nonexistent" ) { print $6 }'); do
debug "Working on $DIR"
for FILE in $DIR/.[A-Za-z0-9]*; do
for FILE in "$DIR"/.[A-Za-z0-9]*; do
if [ ! -h "$FILE" ] && [ -f "$FILE" ]; then
FILEPERM=$(ls -ld $FILE | cut -f1 -d" ")
if [ $(echo $FILEPERM | cut -c6) != "-" ]; then
FILEPERM=$(ls -ld "$FILE" | cut -f1 -d" ")
if [ "$(echo "$FILEPERM" | cut -c6)" != "-" ]; then
crit "Group Write permission set on FILE $FILE"
ERRORS=$((ERRORS + 1))
fi
if [ $(echo $FILEPERM | cut -c9) != "-" ]; then
if [ "$(echo "$FILEPERM" | cut -c9)" != "-" ]; then
crit "Other Write permission set on FILE $FILE"
ERRORS=$((ERRORS + 1))
fi
@ -46,14 +46,14 @@ audit() {
# This function will be called if the script status is on enabled mode
apply() {
for DIR in $(get_db passwd | egrep -v '(root|halt|sync|shutdown)' | awk -F: '($7 != "/usr/sbin/nologin" && $7 != "/bin/false" && $7 !="/nonexistent" ) { print $6 }'); do
for FILE in $DIR/.[A-Za-z0-9]*; do
for FILE in "$DIR"/.[A-Za-z0-9]*; do
if [ ! -h "$FILE" ] && [ -f "$FILE" ]; then
FILEPERM=$(ls -ld $FILE | cut -f1 -d" ")
if [ $(echo $FILEPERM | cut -c6) != "-" ]; then
FILEPERM=$(ls -ld "$FILE" | cut -f1 -d" ")
if [ "$(echo "$FILEPERM" | cut -c6)" != "-" ]; then
warn "Group Write permission set on FILE $FILE"
chmod g-w "$FILE"
fi
if [ $(echo $FILEPERM | cut -c9) != "-" ]; then
if [ "$(echo "$FILEPERM" | cut -c9)" != "-" ]; then
warn "Other Write permission set on FILE $FILE"
chmod o-w "$FILE"
fi