[chk_nonexistent_ids] Fixed logging handling

This commit is contained in:
ayakael 2018-04-15 22:43:35 -04:00
parent c3217d543a
commit 29b8f4d4af
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026

View file

@ -22,14 +22,15 @@ chk_nonexistent_ids() {
local IMAGEID="$(cut -d"=" -f1 <<< ${row})"
local TRACKID="$(cut -d"=" -f2 <<< ${row})"
local FILE="$(cut -d"=" -f3 <<< ${row})"
local NONEXISTENT=false
echo "[ ${COUNT} / ${#rowList[@]} ] Checking path of ${TRACKID}"
if [[ ! -f "${TARGET}/${FILE}" ]] && [[ ${FILE} != "null" ]]; then
gawk -i inplace -v imageid=${IMAGEID} -v trackid=${TRACKID} 'BEGIN{FS="\t";OFS="\t"}{if($2==imageid && $3==trackid){$4="null"}{print $0}}' ${DB_FILE}
local $?=1
local NONEXISTENT=true
fi
[[ $? -eq 0 ]] || { echo "[>>>>>>] Error reported"; echo "${TRACKID} of ${IMAGEID} points to non-existent file"}; local ERR=true; }
[[ "${NONEXISTENT}" == "true" ]] && { echo "[>>>>>>] Error reported"; echo "${TRACKID} of ${IMAGEID} points to non-existent file"}; local ERR=true; }
local COUNT=$(( ${COUNT} + 1 ))
done
[[ "${ERR}" == "true" ]] && return 1 || return 0