From 779b2cc81dc1a8865462a6a93d59f93b127ced2d Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 13 May 2017 21:23:51 +0300
Subject: [PATCH] - Better implementation of ssh-keyscan-add shell function.

---
 .bashrc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.bashrc b/.bashrc
index 65cd886..ce6dbff 100644
--- a/.bashrc
+++ b/.bashrc
@@ -85,8 +85,8 @@ deduce_aws_region () {
 }
 
 ssh_keyscan_add () {
-    # shellcheck disable=SC2094
-    (ssh-keyscan "$@"; cat "$HOME/.ssh/known_hosts") | sort -u >> "$HOME/.ssh/known_hosts"
+    ssh-keyscan "$@" >> "$HOME/.ssh/known_hosts"
+    sort -uo "$HOME/.ssh/known_hosts" "$HOME/.ssh/known_hosts"
 }
 
 gen_csr () {
-- 
GitLab