From d24140b4de9c3c561ffaa4f75a4de1e714b49984 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Thu, 23 Apr 2020 08:06:49 +0200 Subject: [PATCH] ip_to_hex function --- .functions.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.functions.sh b/.functions.sh index 5b9b1e6..afab2dc 100644 --- a/.functions.sh +++ b/.functions.sh @@ -55,3 +55,7 @@ function copy_k8s_token(){ grep "id-token" ~/.kube/config | awk '{print $2}' | xclip -sel clip } +function ip_to_hex(){ + IFS=. read oct1 oct2 oct3 oct4 <<< "$1" + printf '0x%02x%02x%02x%02x\n' $oct1 $oct2 $oct3 $oct4 +}