Skip to content

Instantly share code, notes, and snippets.

@jkoppel
Created January 20, 2024 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkoppel/80f8b64a44b63b16db4c3cdd3392fe8f to your computer and use it in GitHub Desktop.
Save jkoppel/80f8b64a44b63b16db4c3cdd3392fe8f to your computer and use it in GitHub Desktop.
# Lookup shell on explainshell
function explain() {
# Example url: http://explainshell.com/explain/tar?args=xzvf+archive.tar.gz
URL="http://explainshell.com/explain"
FIRST=0
for i; do
if [ $FIRST -eq 0 ]; then
URL="${URL}/$i?args="
FIRST=1
elif [ $FIRST -eq 1 ]; then
URL="${URL}${i}+"
fi
echo "arg: $i"
done
# Remove last +
URL="${URL%?}"
#echo "URL is $URL"
open "$URL"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment