How can I get "help" with vanilla sh builtins?
I discovered that the -s flag for read is a Bash-ism:
$ bash -c 'read -s -n 1' # waits until I press a key
$ sh -c 'read -s -n 1'
sh: 1: read: Illegal option -s
Vanilla sh does offer read:
$ sh -c 'type read'
read is a shell builtin
But I can't read help for the vanilla version:
$ help read # shows help for the Bash version
$ sh -c 'help read'
sh: 1: help: not found
$ man read # can only find the C system call, regardless of shell
This is not about the actual use of read. Rather: how can I read the manual properly?
1 answer
The following users marked this post as Works for me:
| User | Comment | Date |
|---|---|---|
| Karl Knechtel | (no comment) | Jul 2, 2025 at 06:40 |
I use man sh and then /^\s+read to get to the section of the man page that discusses the appropriate builtin.
You can get a direct link to the Bash read in Debian's manpage site, which has this to say about -s:
-sSilent mode. If input is coming from a terminal, characters are not echoed.
The sh manpage doesn't identify read as an important thing to anchor, but you can still find it.
I personally find it kind of annoying that the shells' builtins have a huge section devoted to them rather than being broken into multiple man pages, but one can imagine why this is important: As you noticed, you could be in Bash and run sh -c 'read foo' or something, which changes what read is able to do.

0 comment threads