Reputation: 22113
I am learning read
command,
there are multiple options including -p
, -e
, -i
,
For instance:
if read -t 10 -sp "Enter secret passphrase > " secret_pass; then
echo -e "\nSecret passphrase = 'secret_pass'"
else
echo -e "\nInput timed out" >&2
exit 1
fi
However, I cannot locate the options from commmand line
$ man read | grep -e '-e' -e '-p'
#it return nothing.
Additionally I checked BSD official and failed to find the options. read(2)
How to check them from command line?
Upvotes: 0
Views: 133
Reputation: 19395
How to check them from command line?
It's easiest with nautical's suggestion help read
, provided that your command line shell is bash
, or bash -c 'help read'
in case your command line shell is some other kind of shell.
If you want to read the manual section rather than the help
text, you could use:
man bash | more +/'read *\['
man cd
shows its BSD builtins,help cd
shows it's GNU bash builtin, version 4.4.19(1).When Icd dir
in command line, whose builtin is working?
The built-in command of the used shell is executed. If unsure which shell it is, enter echo $0
.
Upvotes: 1
Reputation:
The command read
is a shell built-in. You can either check the manual for Bash
man bash
and search for read
or you can type
help read
in a Bash
shell.
UPDATE
Your follow up question from the comments:
Bash will use its builtin function first. If there is also an executable on your system, which you want to use instead, then you will have to call it by its full path, e.g.,
$ echo Hello # This calls Bash's version of echo
$ /usr/bin/echo World # This calls echo that was installed with the OS
This applies to all commands that exist as executable on the system and also have a builtin counterpart. I am not familiar with BSD but on Linux there is no cd
executable. This would mean that a program can change Bash's working directory from outside. I do not know why BSD has such a program and if Bash
would even allow it to change its working directory.
Upvotes: 3