-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add silent mode in read builtin #838
Comments
On the one hand I want to say that fish scripting is mainly meant for scripting fish, I think, and what use does this have for that? On the other hand, I'm a sucker for security and think shoulder surfing is scary! Maybe we could have it print asterisks or bullets for each typed character, mimicking GUI password inputs? Some feedback that the keys actuated and that the input got sent to the right window/terminal. |
Another thing that this got me thinking about would be auto-accepting, like it takes one char and then accepts it.
|
@dag I'd like to be able to prompt for a password as part of setting up my proxy server environment variables. |
This is my workaround, not sure how portable it is:
|
I'm not sure what you mean by that. How is a silent read option, not fish scripting? Regarding what use it has, the i think it would have the same uses as As a sidenote, a silent option would be great, as the alternative seems to be this verbose option: stty -echo
if not read foo
stty echo
exit $status
stty echo |
Any news on that issue? Would be great. Thanks for the workaround though. Edit: Just tried the workaround. Didn't work. After |
@ridiculousfish Any comment on this? A proper silent option is really useful (needed even?) |
Seems reasonable to me. |
|
@jhillyerd's code as a function: function readPasswd # prompt targetVar
echo -n $argv[1]
stty -echo
head -n 1 | read -g $argv[2]
stty echo
echo
end |
I was writing a script this morning and was rather disappointed to discover I couldn't input via a "password" mode. Hoping this get implemented soon. |
This seems like a nice to have feature |
Turns out |
👍 For a userland implementation see: #2166 (comment) |
Closed with squashed merge commit 8213885. |
woo!! GitHub - fish-shell/fish-shell - fish 2.6.0 (released June 3, 2017):
|
Can we update the docs please?
|
@mustafawm: We have, you're looking at an outdated version. See https://fishshell.com/docs/current/commands.html#read. |
Oh! thanks @faho, I was running an older version (2.6) ...just installed the latest (3) via homebrew. |
FWIW, made a very simple package to hide the input (instead of obscuring it): fish-read-silent And an example use case as a dependency in another package: fish-index |
In silent mode, typed characters are not shown in terminal, Bash supports silent mode with '-s' flag, so
read -s
will not echo characters on terminal. We should have similar flag in fish's read builtin.The text was updated successfully, but these errors were encountered: