From 193c737232d7b7bbb141b7b8f3d076fdb6f3d162 Mon Sep 17 00:00:00 2001
From: Luca Bilke <luca@bil.ke>
Date: Wed, 13 Nov 2024 18:30:29 +0100
Subject: [PATCH] zsh: add hosthost function

---
 common/.config/zsh/config/functions.zsh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/common/.config/zsh/config/functions.zsh b/common/.config/zsh/config/functions.zsh
index 98f36e44..dd719739 100644
--- a/common/.config/zsh/config/functions.zsh
+++ b/common/.config/zsh/config/functions.zsh
@@ -14,6 +14,16 @@ function xsi() {
 }
 
 function whed() {
+    local script
     script=$(which "$1")
     [ -e "$script" ] && $EDITOR $(which "$script")
 }
+
+function hosthost() {
+    local ip
+    ip=$(
+        host -t A "$1" | awk '{print $4}' ||
+        host -t AAAA "$1" | awk '{print $5}'
+    )
+    host "$ip" | awk '{print $5}' | sed 's/.$//'
+}