Where can I read the help for all Do Shell Script commands?

Where can I read the help for all Do Shell Script commands?

For example, there is a "test" command. Which reference book mentions this command? I.e. I want to go to some website, all the Do Shell Script commands will be there, and among these commands I will find the "test" command.

Or are there no such directories and the programmer should randomly find commands on the Internet on random sites?

Answered by DTS Engineer in 791655022

Do you know about “man pages” ?

Note that test is not typical because it is normally a shell builtin.

endecotp, yes, I know about “man”. Is it possible to see all possible commands using "man"? Now I know how to view information for one specific command.

Is it possible to see all possible commands using "man"?

No.

There is man -k for a keyword search.

You can find linux man pages online with complete lists of commands, e.g. at https://linux.die.net/man/1/ ; that is of limited use because (a) the available macOS commands differ, and (b) the list is too long to find anything in practice.

I’m unsure what to recommend for learning shell programming. I still have a copy of Kernighan & Pike on my bookshelf - it is 30 years old, and while it is still mostly accurate I doubt that it will teach you what you want to know.

it is normally a shell builtin.

Recently I learnt that macOS’s default interactive shell, zsh, has a built-in which where the -a option shows you exactly what you get:

% which -a test
test: shell built-in command
/bin/test

Nice!

No.

Well, not easily (-:

The -d flag will print all the paths searched by man:

% man -d test 2>&1 | grep "Using manual path"
-- Using manual path: /usr/local/share/man:/usr/share/man:…

You can then list each of these directories to discover all the man pages.

But, yeah, that’s clunky. I tend to use a GUI app for reading man pages. Right now I’m using Man Reader, which shows all the pages on its sidebar.

I still have a copy of Kernighan & Pike on my bookshelf

Likewise.

Although my general advice is that, once you start writing if statements in shell, it’s time to switch to a better language (-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Where can I read the help for all Do Shell Script commands?
 
 
Q