]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
combine if/elif to avoid duplication of the action
authorPhilip Hands <phil@hands.com>
Sat, 3 Oct 2020 21:15:16 +0000 (23:15 +0200)
committerDarren Tucker <dtucker@dtucker.net>
Tue, 13 Oct 2020 01:45:05 +0000 (12:45 +1100)
SSH-Copy-ID-Upstream: 42aeb1cc53d3f7f6e78edc210fb121fda0834914

contrib/ssh-copy-id

index 6cea9935bee8963962f797f87e685ed65d0c3132..1870aed552c1a091d0cc33e5b949b26d51650218 100644 (file)
@@ -201,10 +201,11 @@ populate_new_ids() {
             -o LogLevel=INFO \
             -o PreferredAuthentications=publickey \
             -o IdentitiesOnly=yes "$@" exit >"$L_OUTPUT_FILE" 2>&1 </dev/null
-        if [ "$?" = "$L_SUCCESS" ] ; then
-          : > "$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 || {