Skip to content

Instantly share code, notes, and snippets.

@mesprague
Created August 31, 2014 02:01
Show Gist options
  • Save mesprague/6ce9d8ed2fd7e6ac7968 to your computer and use it in GitHub Desktop.
Save mesprague/6ce9d8ed2fd7e6ac7968 to your computer and use it in GitHub Desktop.
One liner for the asus RT-N66U router to display nvram contents as json
nvram2json() { echo $(nvram show 2>/dev/null | egrep -v '^$' | sort | sed 's/^\(.*\)=\(.*\)/"\1":"\2"/;1 s/^/{\n/;$ !s/$/,/;$a}'); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment