I always find the context switch to get to a website jarring, and really really love tools that give me documentation on the command line. For example, I can type "go doc foo.Bar" and instantly read the docs for foo.Bar (where foo is usually resolved to example.com/some/go/package/foo, based on what is in go.mod and installed on the system). So for this, I would really like bash's built-in help to show me all this stuff.
They did a 10% implementation of what would be good:
$ help [
[: [ arg... ]
Evaluate conditional expression.
This is a synonym for the "test" builtin, but the last argument must
be a literal `]', to match the opening `['.
But it doesn't know how to dive into [ and show docs for the operators, i.e., "help [ -e" doesn't work. The [ documentation also doesn't tell you what options are available, and of course [ doesn't implement --help (but, of course, /bin/[ does. And people say computers are hard to use! Psh!).
So anyway, if this could all be fixed with a command-line utility, that would be wonderful. It is likely that if I ever need to remember what [ -e does, I'll "man [" or failing that "info bash" or failing that, give up and write the program in go so at least I can work from some documentation.
> It is likely that if I ever need to remember what [ -e does
I realize a lot of folks consider the context switch to paper to also be jarring, but this is why I like analog reference works. I remember roughly how far in to the book the table of all those obscure flags are, and the book more or less falls open to it, because I've been there before.
> "help [ -e" doesn't work. The [ documentation also doesn't tell you what options are available
Well, knowing that `[` is the same as `test`, you can `man test` to see the available options.
Personally, I avoid `[` for `[[`. To see the options for that, I do `man bash`, then type `/\[\[`, hit Enter, and press `n` a few times until the list of options appears. It's in the "CONDITIONAL EXPRESSIONS" section.
Almost everything shown in this site is available in bash's manpage.
GNU's `ls` has most of its documentation in `info ls`.
There's no need to turn to websites. All documentation is available locally from the command line. If anything, it just requires a bit of skill in searching. With `man`/`less`, you search with `/` like I showed; in `info`, you search with <Ctrl-s>.
Also, `command [ --help` does work. It's not the same as the built-in, but it should be mostly the same.
> I always find the context switch to get to a website jarring, and really really love tools that give me documentation on the command line.
Heh, as a person who mostly writes Clojure code, I always find the context switch to go to the command line jarring and really really love tools that give me the documentation straight in my editor!
I understand the concern, but [ is one of those idiosyncratic shell builtins that you eventually get used to and the help does point you toward maybe typing "help test". But, yeah it should probably say it explicitly or just append the "help test" content when it prints "help [".
They did a 10% implementation of what would be good:
But it doesn't know how to dive into [ and show docs for the operators, i.e., "help [ -e" doesn't work. The [ documentation also doesn't tell you what options are available, and of course [ doesn't implement --help (but, of course, /bin/[ does. And people say computers are hard to use! Psh!).So anyway, if this could all be fixed with a command-line utility, that would be wonderful. It is likely that if I ever need to remember what [ -e does, I'll "man [" or failing that "info bash" or failing that, give up and write the program in go so at least I can work from some documentation.