`eend 0` does effectively nothing, so let's remove it
Closed this issue · 0 comments
adrelanos commented
eend() {
local retval="${1:-0}"
shift
if [ "$retval" -gt 0 ]; then
printf " %s-> Failed (rc=%s)%s\\n" "${BAD}" "${retval}" "${NORMAL}"
fi
return "$retval"
}
eend 0
just results in return 0
which doesn't do anything.
In preparation of #224 for code simplification it would be best to remove these.
A very few cases are a tiny bit more complex.
if cp "$AUTHORIZED_KEYS_SOURCE" "$AUTHORIZED_KEYS_TARGET" ; then
eend 0
else
eerror "Error: copying '$AUTHORIZED_KEYS_SOURCE' to '$AUTHORIZED_KEYS_TARGET' failed"
eend 1
bailout 1
fi
Could rewrite to:
if ! cp "$AUTHORIZED_KEYS_SOURCE" "$AUTHORIZED_KEYS_TARGET" ; then
eerror "Error: copying '$AUTHORIZED_KEYS_SOURCE' to '$AUTHORIZED_KEYS_TARGET' failed"
eend 1
bailout 1
fi