diff options
author | Gordon GECOS <u@adam> | 2021-03-12 12:28:49 -0500 |
---|---|---|
committer | Gordon GECOS <u@adam> | 2021-03-12 12:28:49 -0500 |
commit | c3e55d0711087d1f8b97c532e8d96289ee59271f (patch) | |
tree | a5d990224acdda2fdb0bae26d56c12d56c2d41a1 | |
parent | ffeb8d561a8fb99b6f02038aaffe0d6ae23a7d9b (diff) |
improve correctness in case vprintf fails
-rwxr-xr-x | penme | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -35,6 +35,10 @@ ssh-keyscan - $(scan_network) 2>/dev/null | | |||
35 | while read ip key | 35 | while read ip key |
36 | do | 36 | do |
37 | line=$(printf '%s penme host key @ %s\n' "$key" "$ip") | 37 | line=$(printf '%s penme host key @ %s\n' "$key" "$ip") |
38 | grep -q -Fx "$line" /root/.ssh/authorized_keys && vprintf 'Already authorized: %s\n' "$line" || | 38 | if grep -q -Fx "$line" /root/.ssh/authorized_keys |
39 | write "$line" /root/.ssh/authorized_keys | 39 | then |
40 | vprintf 'Already authorized: %s\n' "$line" | ||
41 | else | ||
42 | write "$line" /root/.ssh/authorized_keys | ||
43 | fi | ||
40 | done | 44 | done |