#!/bin/sh if pgrep babeld >/dev/null; then neighbours="$(echo dump | nc ::1 33123 | grep '^add neighbour' | awk '{ for (i=2; i < NF; i += 2) { vars[$i] = $(i+1) } } { printf "%s%s%s", vars["address"], vars["if"], vars["cost"] }')" echo -n "$neighbours" fi exit 0