summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-10-16 12:07:21 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-10-16 12:07:21 +0200
commitcb97cb065ebd7fa5e447a314a2421109ef9c3339 (patch)
tree62f0e4d70ae2d708b95e4882b4af6601a7caf152 /bin
parent0f7b4712384ae7edfe2234d56fd085791327b832 (diff)
added setip
Diffstat (limited to 'bin')
-rwxr-xr-xbin/extra/setip16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/extra/setip b/bin/extra/setip
new file mode 100755
index 0000000..b10e7cc
--- /dev/null
+++ b/bin/extra/setip
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+ips="192.168.178.79 192.168.178.52 10.7.0.1 none"
+
+for ip in $ips
+do ping -i .2 -c 1 "$ip" > /dev/null 2>&1 && break
+done
+
+if [ "$ip" = "none" ]
+then
+ >&2 printf 'No ip.\n'
+ exit 1
+fi
+
+sed -i "/Host db/,/^$/s/.*HostName.*/\tHostname $ip/" "$HOME"/.ssh/config
+>&2 printf 'Done: %s \n' "$ip"