Skip to content

Instantly share code, notes, and snippets.

@ekyo
Created August 30, 2013 11:47
Show Gist options
  • Save ekyo/6389069 to your computer and use it in GitHub Desktop.
Save ekyo/6389069 to your computer and use it in GitHub Desktop.
Bash script for querying explainshell.com from the command line. Requires curl to be installed.
#!/bin/bash
URL=$(echo "http://explainshell.com/explain/$1?args=${@:2}" | sed -e 's/ /+/g')
curl -s "$URL" | sed -n '/<pre/,/<\/pre>/p' | sed -n '/<pre/,/<\/pre>/p' | sed -s 's/<[^>]*>//g' | \
sed -e 's/^ *//g;s/ *$//g' | grep '.' | cat
@ekyo
Copy link
Author

ekyo commented Aug 30, 2013

to install:

sudo apt-get install curl
sudo wget https://gist.github.com/ekyo/6389069/raw/a15ded3526f639c61e5417345a601419706fae7f/explain > /usr/local/bin/explain    

@ekyo
Copy link
Author

ekyo commented Aug 30, 2013

Exemple Usage:

> explain ls -ltrsa
list directory contents
-l     use a long listing format
-t     sort by modification time, newest first
-r, --reverse
reverse order while sorting
-s, --size
print the allocated size of each file, in blocks
-a, --all
do not ignore entries starting with .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment