Another trick I use is to put all of my stuff into .ssh/config.d/ and then run `ssh-compile` and it generates .ssh/config for me.
This lets me pull in new config files and hosts without having to redo everything every time.
This lets me pull in new config files and hosts without having to redo everything every time.
`Include ~/.ssh/config.d/*`
Edit to say that my compile function does a syntax check too… but this is easier than setting up the dir listener.
I just add a new entry to the bottom, `nvim ~/.ssh/config` -- what is better about your approach / what am I missing out on?
(Have never heard of ssh-compile, will also look it up when not on mobile.)
#!/bin/sh SSH_DIR="/Users/nvahalik/.ssh/config.d/" echo "" > ~/.ssh/config for i in `ls "${SSH_DIR}"`; do echo "# ${SSH_DIR}${i}" >> ~/.ssh/config cat "${SSH_DIR}${i}" >> ~/.ssh/config echo "\n" >> ~/.ssh/config done; chmod 644 ~/.ssh/config
# If ~/.ssh/config does not exist, copy file
if [ ! -f ~/.ssh/config ]; then
cp ./.ssh/config ~/.ssh/config
else
# For each block in ./.ssh/config, if it is not in ~/.ssh/config, add it
while read -r line; do
if [[ "$line" == "" ]]; then
if grep -q "$block" ~/.ssh/config; then
# If block is not found, add it to ~/.ssh/config
echo "$block" >> ~/.ssh/config
fi
else
if [[ -z "$block" ]]; then
block="$line"
else
block="$block$line\n"
fi
fi
done < ./.ssh/config
fi