#!/bin/sh # PPP information utilities # Print the PPP IP address pppIP() { ipconfig |sed -n -e '/^PPP/,$ p' | sed -n -e '/IP Address/ s/.*: //p' } # Print the PPP DNS name pppDNS() { nslookup "$(pppIP)" |sed -n -e '/^Name:/ s/^Name: *//p' } # Display the PPP IP address and DNS name pppInfo() { ip="$(pppIP)" echo "PPP IP: $ip" echo "PPP DNS: $(nslookup "$ip" |sed -n -e '/^Name:/ s/^Name: *//p')" } # Notify user that no sub-function was specified pppIdent() { echo "Usage: pppIP | pppDNS | pppInfo" >&2 # Generate aliases as needed cd "${0%/*}" && \ ( [ ! -f pppIP ] && ln pppIdent pppIP [ ! -f pppDNS ] && ln pppIdent pppDNS [ ! -f pppInfo ] && ln pppIdent pppInfo ) exit 1 } # Invoke the specified sub-option "${0##*/}" "$@"