Browse Source

Colourise output

master
JustAnotherArchivist 3 years ago
parent
commit
77d9f61de0
1 changed files with 21 additions and 3 deletions
  1. +21
    -3
      iasha1check

+ 21
- 3
iasha1check View File

@@ -15,9 +15,15 @@ readarray -t iaMissing < <(comm -23 <(printf "%s\n" "${localFilesSorted[@]}") <(

status=0

RED=$'\x1b[1;31m'
GREEN=$'\x1b[0;32m'
RESET=$'\x1b[0m'

if [[ ${#localMissing[@]} -eq 0 && ${#iaMissing[@]} -eq 0 ]]
then
echo "File list comparison: OK"
echo "File list comparison: ${GREEN}OK${RESET}"
else
echo "File list comparison: ${RED}FAIL${RESET}"
fi
if [[ ${#iaMissing[@]} -gt 0 ]]
then
@@ -32,12 +38,24 @@ then
status=1
fi

echo

echo "SHA-1 comparison:"
sha1sum -c < <(printf "%s\n" "${iasha1sums[@]}") > >(sed 's,^, ,') 2>&1
if [[ $? -ne 0 ]]
if [[ $? -eq 0 ]]
then
echo "SHA-1 comparison failed!"
echo "SHA-1 comparison: ${GREEN}OK${RESET}"
else
echo "SHA-1 comparison: ${RED}FAIL${RESET}"
status=1
fi

echo

if [[ ${status} -eq 0 ]]
then
echo "${GREEN}OK${RESET}"
else
echo "${RED}FAIL${RESET}"
fi
exit ${status}

Loading…
Cancel
Save