combine if/elif to avoid duplication of the action

SSH-Copy-ID-Upstream: 42aeb1cc53d3f7f6e78edc210fb121fda0834914
This commit is contained in:
Philip Hands 2020-10-03 23:15:16 +02:00 committed by Darren Tucker
parent f7c3a39b01
commit fd36017459
1 changed files with 5 additions and 4 deletions

View File

@ -201,10 +201,11 @@ populate_new_ids() {
-o LogLevel=INFO \ -o LogLevel=INFO \
-o PreferredAuthentications=publickey \ -o PreferredAuthentications=publickey \
-o IdentitiesOnly=yes "$@" exit >"$L_OUTPUT_FILE" 2>&1 </dev/null -o IdentitiesOnly=yes "$@" exit >"$L_OUTPUT_FILE" 2>&1 </dev/null
if [ "$?" = "$L_SUCCESS" ] ; then if [ "$?" = "$L_SUCCESS" ] || {
: > "$L_TMP_ID_FILE" [ "$SFTP" ] && grep 'allows sftp connections only' "$L_OUTPUT_FILE" >/dev/null
elif [ "$SFTP" ] && grep 'allows sftp connections only' "$L_OUTPUT_FILE" >/dev/null ; then # this error counts as a success if we're setting up an sftp connection
# this error counts as a success when we're setting up an sftp connection }
then
: > "$L_TMP_ID_FILE" : > "$L_TMP_ID_FILE"
else else
grep 'Permission denied' "$L_OUTPUT_FILE" >/dev/null || { grep 'Permission denied' "$L_OUTPUT_FILE" >/dev/null || {