fixes and improvements
[distro-setup] / brc
diff --git a/brc b/brc
index fdd8e2cf73b6b564f94e185feb7e2192ea74eef7..6322eb97c22063be93d93b6feb0f0969ef24e668 100644 (file)
--- a/brc
+++ b/brc
@@ -779,6 +779,19 @@ despace() {
   done
 }
 
+# get ipv4 ip from HOST. or if it is already a number, return that
+hostip() {
+  local host="$1"
+  case $host in
+    [0-9:])
+      echo "$host"
+      ;;
+    *)
+      getent ahostsv4 "$host" | awk '{ print $1 }' | head -n1
+      ;;
+  esac
+}
+
 dig() {
   command dig +nostats +nocmd "$@"
 }
@@ -827,7 +840,7 @@ dus() { # du, sorted, default arg of
 ccomp du dus
 
 
-e() { printf "%s\n" "$@"; }
+e() { printf "%s\n" "$*"; }
 
 # echo args
 ea() {