Image

Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

How can I get "help" with vanilla sh builtins?

+3
−0

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?

History

0 comment threads

1 answer

+2
−0

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:

  • -s Silent 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.

History

0 comment threads

Sign up to answer this question »