Im in need of a script to get external ioaddress and replace at the end of an ssh config file
I have so far
#!/bin/sh
IP=$(wget http://ipecho.net/plain -qO-)
For a variable I can echo but need a way to replace curent external ip with new one in ssh config which looks like
Host $IP
User UserName
Port 22
IdentityFile ~/.ssh/id_rsa
Host home
HostName 192.168.0.1
Host away
HostName 97.113.55.62
Away is external
So what I need is replace the external ip in my ssh config ex. HostName 192.168.0.1 (old ip) HostName 192.168.0.2 (new ip)