How to read in silent mode in Fish

Silent mode is an useful feature in shells to read sensitive information like passwords. The text typed by the user is not displayed on the displayed nor stored anywhere on file.

Sadly, the Fish shell does not have a true silent mode in its read command. Also, when used with default options, the password (or input) entered to the read command is stored in ~/.config/fish/fish_read_history.

The best we can do is to make the read command not store its history. This can be achieved by passing /dev/null as the history file for read:

read -m /dev/null var_to_store_password

Tried with: Fish 2.2.0 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s