1

Well, the command help returns a two column list which includes the syntax of all builtin commands.

The command help -d returns exactly the same as above.

The command help -d printf returns a short description of the command printf:

printf - Formats and prints ARGUMENTS under control of the FORMAT.

The command help -d p returns short descriptions of all the commands starting with p:

popd - Remove directories from stack.
printf - Formats and prints ARGUMENTS under control of the FORMAT.
pushd - Add directories to stack.
pwd - Print the name of the current working directory.

So, is there some way of producing a list of short descriptions for all commands?

2
  • 3
    I suggest help -d \* or help -d "*"? Commented Dec 10, 2020 at 22:53
  • I tried help -d * and it didn't work. I wonder why I didn't think of backslash or quotes. Probably too tired. Thank you for your suggestion. Commented Dec 10, 2020 at 23:13

1 Answer 1

1

This is the command you're looking for:

help -d ''

This works because help expects a pattern as the final argument, and an empty pattern will match all topics. You can pass an empty argument to a command by using '' or "".

I suspect the help source code contains a statement like the following pseudocode:

if (pattern) {
    results = search(pattern);
    print(results);
}
else {
    print(OVERVIEW_TABLE)
}
Sign up to request clarification or add additional context in comments.

1 Comment

Yes, this works as well as Cyrus's suggestions on previous comment. Can you provide some explanation or link to an explanation to understand why this works?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.