Skip to content

Instantly share code, notes, and snippets.

@backus
Created August 30, 2013 08:13
Show Gist options
  • Save backus/6387485 to your computer and use it in GitHub Desktop.
Save backus/6387485 to your computer and use it in GitHub Desktop.
command line explain for http://explainshell.com
#!/bin/bash
cmd="$(cut -d ' ' -f 1 <<< "$@" )";
args="$(cut -d ' ' -f 2- <<< "$@" )";
url="http://explainshell.com/explain/$cmd?args=$args"
explanation="$(curl -s $url | grep '<pre' | sed -E 's/<\/?[a-z]+(\ [a-z]+=\"[a-z0-9]+\")*>//g' | sed -E 's/^\ +//g')"
echo "$explanation"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment