Last active
August 29, 2015 14:04
-
-
Save Archenoth/6b66b1852fefd17c1b88 to your computer and use it in GitHub Desktop.
Ever felt an overwhelming urge to use words as command line arguments? Neither have I...but here's a script to find valid commands like "ls -chlorofluorocarbons" or "ls -Spank" anyway! Requires aspell.
This file contains hidden or 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 | |
| ([ -z "$1" ] || [ -n "$2" ]) && cat <<EOF && exit 1 | |
| wordparam: Find words you can make with the short parameters of commands. | |
| Author: Matthew (Archenoth) MacLean | |
| Usage: "$0 <command>" | |
| EOF | |
| man $1 &>/dev/null || { | |
| echo "Cannot find manpage for $1" | |
| exit 1 | |
| } | |
| echo "Generating for $1..." | |
| aspell -d en dump master | aspell -l en expand | \ | |
| grep -e "$(echo "["$(for i in $(man $1 | grep -oe '\s-[a-Z]' | sort | uniq | cut -d'-' -f2); do echo -n $i; done)"]*")" -o | sort | uniq | \ | |
| less |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment