#!/bin/bash # Print the first IP address of the local host. # hostname -i returns space-separated IPs; tr converts spaces to newlines so # head/tail can reliably extract just the first entry (typically the LAN IP). hostname -i | tr ' ' '\n' | head -n1 | tail -n1