3 ms·
What I do for my homelab vms and such: # If ~/.ssh/config does not exist, copy file if [ ! -f ~/.ssh/config ]; then cp ./.ssh/config ~/.ssh/config el
by artificialLimbs 4y ago
What I do for my homelab vms and such:
# 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
- dolmen 4y agoOpenSSH now has an Include directive.