#! /usr/bin/env bash
#
# Returns a list of the IP addresses associated with local interfaces.

# On Linux, ifconfig is often not in the user's standard PATH.
export PATH=$PATH:/sbin:/usr/sbin

# Tested the pattern with Linux, FreeBSD and MacOS.
# TODO: Not sure if this is sufficient for IPv6 addresses.
ifconfig -a | sed -n 's/.*inet6\{0,1\} \(addr: *\)\{0,1\}\([^ ]*\).*/\2/gp'
