From 6450e12c92469b3314b49f56370ba3da225b2655 Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Mon, 3 Aug 2015 13:03:32 +0200 Subject: [PATCH] Cleanup and comments --- .bashrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.bashrc b/.bashrc index ca6aefb..15240b2 100644 --- a/.bashrc +++ b/.bashrc @@ -167,15 +167,15 @@ xterm*|rxvt*) esac # SSH config merge -#mkdir -p ~/.ssh/config.d/ if [ -e ~/.ssh/config.d ]; then #if find ~/.ssh/config.d -mindepth 1 -print -quit | grep -q .; then + # Do we have config files in that directory? if find ~/.ssh/config.d -print -quit | grep -q .; then - #newestconfig=$(ls -t ~/.ssh/config.d/ | head -1) newestconfig=$(find ~/.ssh/config.d/* -printf '%T+ %p\n' | sort -r | head -n1 | awk '{print $2}') if [ "$newestconfig" -nt ~/.ssh/config ]; then + # We found a config that's newer than the generated config file, re-generate [ -e ~/.ssh/config ] && mv ~/.ssh/config ~/.ssh/config.bak.$(date -Ins) - #cat ~/.ssh/config.d/* > ~/.ssh/config + # Lets preserve order, so you can have 00_generic 10_homestuff 20_work1 21_work2 and such find ~/.ssh/config.d/* -type f -print0 | sort -z | xargs -0 -n1 cat > ~/.ssh/config fi fi