Created
August 30, 2013 08:13
-
-
Save backus/6387485 to your computer and use it in GitHub Desktop.
command line explain for http://explainshell.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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