Shell Command Syntax Explainer
What this does and doesn't cover
Shell syntax (always covered): pipes (|), logical operators
(&&, ||, ;), backgrounding (&),
output/input redirection (>, >>, <,
<<<), file-descriptor redirects (2>,
2>&1), single/double quoting, variable expansion ($VAR,
${VAR}), and command substitution ($(...), backticks).
Command semantics (covered for a curated set — chmod,
chown, ls, grep, find (including
-exec/-execdir), tar, cp, mv,
rm, mkdir, ps, kill, curl,
wget, ssh, du, df, and the common
pipeline utilities cat/sort/uniq/head/
tail/cut/tr/wc/xargs/
tee/printf/echo): what the program does, what each
flag means for that specific program, what role each argument plays, and a synthesized
summary — of the single command, or of the whole pipeline when commands are chained with
|.
Shell control structures (also covered): for/in/
do/done, while/until, if/
then/elif/else/fi, case/
esac, function, time/coproc, and
{ }/( ) grouping — these are recognized as shell structure, never
mislabeled as external programs, and loop/conditional bodies are parsed recursively.
Parameter expansion (also covered): $VAR,
${VAR}, ${VAR:-default}, ${VAR:=default},
${VAR:+alt}, ${VAR:?err}, ${VAR#pat} /
${VAR##pat} (shortest/longest prefix removal), ${VAR%pat} /
${VAR%%pat} (shortest/longest suffix removal), ${#VAR}, and
${VAR:offset:length} substrings — including when embedded inside a larger
quoted string like "${file%.txt}.bak".
Deliberately not covered: full per-subcommand grammars for
git, docker, kubectl, systemctl,
npm/pnpm/yarn, cargo, go,
terraform, and the major cloud CLIs (aws/gcloud/
az) — git commit and git push have completely
different argument grammars from each other, so a flat flag table would produce wrong
answers. These get an honest "detailed semantics not available yet" on their subcommands
and flags instead of either silence or a guess (rsync is flag-based rather
than subcommand-based, so it gets the same honest treatment without a false "subcommand"
label). When a parse is too unreliable to summarize safely — a malformed find
-exec with no terminator, for instance — this tool says the summary couldn't be
generated rather than guessing at one.