#!/bin/csh
#connectivity_test
clear -x
echo ""
echo ""
echo -n " Whoami: "; whoami
if (-e /Users) then
echo -n " Device: "; echo -n $HOST "(`ioreg -r -k AppleClamshellState -d 4 | grep AppleClamshellState | cut -c31-34 | sed s.No.open.g | sed s.Yes.closed.`)"; echo ""
echo -n " Charge:"; system_profiler SPPowerDataType | grep -A0 "Connected" | sed s." Connected: "..g
endif
echo ""
echo "Hardware (`date`)"
system_profiler SPHardwareDataType | grep -A20 'Model Name' | sed s." "."".g
echo "Software (`date`)"
system_profiler SPSoftwareDataType SPInstallHistoryDataType | grep -A9 'System Version' | sed s." "."".g
set arg1=`route get default | grep interface | cut -c14-17`
echo "Network $arg1"
if (`ipconfig getifaddr $arg1` != "") then
set arg0 = `ipconfig getifaddr $arg1`
echo " `ipconfig getifaddr $arg1` <==> `dig -b $arg0 -4 -t a +short myip.opendns.com @resolver1.opendns.com` `curl --interface $arg1 --connect-timeout 1 -s ipinfo.io/org`"
ifconfig $arg1 | grep 'inet6 2' | grep 'inet6' | sed s."\t"." ".g | sed s."prefixlen 64"."".g
echo " `networksetup -getairportnetwork en0`"
endif
echo ""
echo ""
networkQuality -d
echo ""
networkQuality -u
echo ""
sam.wormley@icloud.com