From: Philip Hands Date: Sat, 3 Oct 2020 21:15:16 +0000 (+0200) Subject: combine if/elif to avoid duplication of the action X-Git-Tag: V_8_5_P1~245 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd360174596047b52aa1cddda74d85012a03ca4b;p=thirdparty%2Fopenssh-portable.git combine if/elif to avoid duplication of the action SSH-Copy-ID-Upstream: 42aeb1cc53d3f7f6e78edc210fb121fda0834914 --- diff --git a/contrib/ssh-copy-id b/contrib/ssh-copy-id index 6cea9935b..1870aed55 100644 --- a/contrib/ssh-copy-id +++ b/contrib/ssh-copy-id @@ -201,10 +201,11 @@ populate_new_ids() { -o LogLevel=INFO \ -o PreferredAuthentications=publickey \ -o IdentitiesOnly=yes "$@" exit >"$L_OUTPUT_FILE" 2>&1 "$L_TMP_ID_FILE" - elif [ "$SFTP" ] && grep 'allows sftp connections only' "$L_OUTPUT_FILE" >/dev/null ; then - # this error counts as a success when we're setting up an sftp connection + if [ "$?" = "$L_SUCCESS" ] || { + [ "$SFTP" ] && grep 'allows sftp connections only' "$L_OUTPUT_FILE" >/dev/null + # this error counts as a success if we're setting up an sftp connection + } + then : > "$L_TMP_ID_FILE" else grep 'Permission denied' "$L_OUTPUT_FILE" >/dev/null || {