From c04f1ec11e3a8816727a28e5a8094b81a51ba00e Mon Sep 17 00:00:00 2001 From: Esa Jokinen Date: Tue, 23 Jul 2024 08:26:51 +0300 Subject: [PATCH] Unified indentation style --- bin/duplicate-ssh-hostkeys.sh | 10 ++++++---- bin/find-inactive-ssh-sessions.sh | 4 ++-- bin/git-find-commits-by-file-hash.sh | 2 +- install.sh | 4 ++-- sbin/backup-mysql-databases.sh | 2 +- sbin/create-site.sh | 6 ++++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bin/duplicate-ssh-hostkeys.sh b/bin/duplicate-ssh-hostkeys.sh index f541168..4976036 100755 --- a/bin/duplicate-ssh-hostkeys.sh +++ b/bin/duplicate-ssh-hostkeys.sh @@ -123,10 +123,12 @@ echo -e "\n\033[0;32mSearching duplicate hostkeys...\033[0m\n" >&2 hostkeys=$(grep "debug1: Server host key" "$tmpdir"/ssh-*.log) -duplicatekeys=$(echo "$hostkeys" \ - | awk '{ print $5" "$6; }' \ - | sort \ - | uniq -d) +duplicatekeys=$( + echo "$hostkeys" \ + | awk '{ print $5" "$6; }' \ + | sort \ + | uniq -d + ) if [ -n "$duplicatekeys" ]; then echo -e "Duplicate host keys found in ${1}!\n" diff --git a/bin/find-inactive-ssh-sessions.sh b/bin/find-inactive-ssh-sessions.sh index 9a91457..ac602df 100644 --- a/bin/find-inactive-ssh-sessions.sh +++ b/bin/find-inactive-ssh-sessions.sh @@ -63,11 +63,11 @@ fi echo "" >&2 # Get TTYs with the seconds since the last access time -TTY_AGES=$( \ +TTY_AGES=$( who -s | awk '{ print $2 }' \ | (cd /dev && xargs stat -c '%U %n %X') \ | awk '{ print $1"\t"$2"\t"'"$(date +%s)"'-$3 }' -) + ) # Get sshd processes of the TTYs; print or kill (-k) while IFS= read -r line ; do diff --git a/bin/git-find-commits-by-file-hash.sh b/bin/git-find-commits-by-file-hash.sh index ee2e193..c7015b9 100755 --- a/bin/git-find-commits-by-file-hash.sh +++ b/bin/git-find-commits-by-file-hash.sh @@ -83,7 +83,7 @@ matches=$( | awk '{print $1}' \ | print_commit_and_checksum "$2" \ | grep -E "[0-9a-f]*:${1}" -) + ) if [[ "$matches" =~ [0-9a-f]+ ]]; then echo "$matches" \ diff --git a/install.sh b/install.sh index 0d358ee..c2021cc 100755 --- a/install.sh +++ b/install.sh @@ -54,7 +54,7 @@ TOINSTALL=$( "Choose the Misc-Scripts to be installed,\nbin => ${BIN}" \ "$HEIGHT" "$WIDTH" "$MENUCOUNT" \ "${MENULIST[@]}" 3>&1 1>&2 2>&3 -) + ) exitstatus=$? if [ "$exitstatus" -ne 0 ]; then printf "Aborting...\n" @@ -83,7 +83,7 @@ TOINSTALL+=$( "Choose the Misc-Scripts to be installed,\nsbin => ${SBIN}" \ "$HEIGHT" "$WIDTH" "$MENUCOUNT" \ "${MENULIST[@]}" 3>&1 1>&2 2>&3 -) + ) exitstatus=$? if [ "$exitstatus" -ne 0 ]; then printf "Aborting...\n" diff --git a/sbin/backup-mysql-databases.sh b/sbin/backup-mysql-databases.sh index 688b8cd..7d9f1ab 100755 --- a/sbin/backup-mysql-databases.sh +++ b/sbin/backup-mysql-databases.sh @@ -55,7 +55,7 @@ date=$(date "+${DatePattern}") databases=$( mysql -N -B -e "SHOW DATABASES;" \ | grep -E -v "$ExcludeDatabases" -) + ) echo "Working directory: $(pwd)" echo "Excluding databases: ${ExcludeDatabases}" diff --git a/sbin/create-site.sh b/sbin/create-site.sh index 631d8e7..6899aea 100755 --- a/sbin/create-site.sh +++ b/sbin/create-site.sh @@ -89,8 +89,10 @@ letsencrypt_hostnames="" hostname_errors=0 for hostname in "${@:2}"; do - validated_hostname=$(echo "$hostname" \ - | grep -P '(?=^.{5,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)') + validated_hostname=$( + echo "$hostname" \ + | grep -P '(?=^.{5,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)' + ) if [ -z "$validated_hostname" ]; then echo "*** ERROR! $hostname is not valid!" ((hostname_errors=hostname_errors+1))