3 ms·
echo "Password: "; read -s pass; stuff --pass "$pass" Where stuff takes password as an argument. Alternatively you can start your line with a space character a
by leni536 11y ago
echo "Password: "; read -s pass; stuff --pass "$pass"
Where stuff takes password as an argument. Alternatively you can start your line with a space character and it isn't stored in your history.
- tempestn 11y agoCool, did not know that about the leading space.
- dr4g0n 11y agoDo be aware though that this only works if HISTCONTROL is set to 'ignorespace' or 'ignoreboth' (for bash anyway). For zsh, you need to have HIST_IGNORE_SPACE set.
- bratch 11y agoThe leading space behaviour is true only if HISTCONTROL="ignorespace" is set.
- leni536 11y agoDid not know that, for me HISTCONTROL=ignoreboth is set in my .bashrc. I think Debian's adduser creates a default .bashrc file where this line is present, I'm not sure though.