Skip to content

Instantly share code, notes, and snippets.

View mitchelhaan's full-sized avatar

Mitchel Haan mitchelhaan

View GitHub Profile
@mitchelhaan
mitchelhaan / macos_wifi_status.sh
Created June 19, 2017 18:50
Run a loop of ping/interface status checks to help diagnose network issues
#!/bin/bash
logfile=~/Desktop/wifi_status.log
interval_sec=10
interface=en0
interface_info_cmd="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I"
# Combine stdout with stderr and pipe to a log file and the screen
exec > >(tee -a "$logfile") 2>&1
@mitchelhaan
mitchelhaan / redir.sh
Created March 2, 2017 21:49
Redirect stderr and stdout to a file and the screen for an entire script
#!/bin/bash -u
logfile=output.log
# Combine stdout with stderr and pipe to a log file and the screen
exec > >(tee "$logfile") 2>&1
# Both of these messages should show up in the console and in the logfile
echo "Test stdout"
echo "Test stderr" >&2

Keybase proof

I hereby claim:

  • I am mitchelhaan on github.
  • I am mitchel (https://keybase.io/mitchel) on keybase.
  • I have a public key ASBUGs0rhhEEOf0un1V3P_xK2YYE4yY8vzFfMFAo_6LG8wo

To claim this, I am signing this object: