[SOLVED] Is there a command like "read" that doesn't show the input?
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a command like "read" that doesn't show the input?
Hi
I have a line in an init script similar to this:
Code:
read password; echo "$password" | encfs -S bla bla bla
As you would guess, "encfs" accepts the $password variable that is read and then piped to encfs.
(The reason why I use the pipe is that in the actual script I use 'su -u user', which somehow disables the normal input from the commandline :$).
My question, guess it from the context and the title, is: Is there another program that acts like 'read', but suppresses the input from being mirrored in the shell (i.e., doesn't show my password) ? If not, is the an applicable way?
TIA
DESCRIPTION
The read utility shall read a single line from standard input.
By default, unless the -r option is specified, backslash ( '\' ) shall act as an escape character, as described in Escape Character (Backslash) . If standard input is a terminal device and the invoking
shell is interactive, read shall prompt for a continuation line when:
* The shell reads an input line ending with a backslash, unless the -r option is specified.
* A here-document is not terminated after a <newline> is entered.
The line shall be split into fields as in the shell (see Field Splitting ); the first field shall be assigned to the first variable var, the second field to the second variable var, and so on. If there are
fewer var operands specified than there are fields, the leftover fields and their intervening separators shall be assigned to the last var. If there are fewer fields than vars, the remaining vars shall be
set to empty strings.
The setting of variables specified by the var operands shall affect the current shell execution environment; see Shell Execution Environment . If it is called in a subshell or separate utility execution
environment, such as one of the following:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.