[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.
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.
Is there a command like "read" that doesn't show the input?
I have a line in an init script similar to this:
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?
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: