shellcheck based code cleanup

This commit is contained in:
Clemens Schwaighofer
2024-09-04 11:16:05 +09:00
parent 5bf30a8b2f
commit e4ed6fed8d
2 changed files with 59 additions and 60 deletions

View File

@@ -7,14 +7,14 @@ LIST=0;
SKIP_USERS=();
while getopts ":gls:" opt; do
case "${opt}" in
g|go)
g) # go
# default we test
TEST=0;
;;
s|skip)
s) # skip
SKIP_USERS+=("${OPTARG}");
;;
l|list)
l) # list
LIST=1;
;;
\?)
@@ -29,7 +29,7 @@ done;
# detect ssh authorized_keys setting
SSH_CENTRAL_AUTHORIZED_FILE_FOLDER='';
SSH_MASTER_AUTHORIZED_FILE='';
SSH_AUTHORIZED_FILE='';
# SSH_AUTHORIZED_FILE='';
for cf in $(grep "^AuthorizedKeysFile" /etc/ssh/sshd_config | grep "%u"); do
if [ ! -z $(echo "${cf}" | grep "%u") ]; then
SSH_CENTRAL_AUTHORIZED_FILE_FOLDER=$(echo "${cf}" | sed -e 's/%u//');
@@ -66,7 +66,7 @@ if [ ${LIST} -eq 1 ]; then
fi;
# base folder
BASE_FOLDER=$(dirname $(readlink -f $0))"/";
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
# output printf
PRINTF_INFO="%-8s [%3s]: %-25s: %s\n";
# list of user accounts we will never touch