Hacker News new | ask | show | jobs
by tzs 1773 days ago
> In some cases I had to chuck a "!" on the end to meet a "must contain a symbol" requirement.

Put the "!" at the front or in the middle. That way if you accidentally type or paste the password into bash or zsh it won't end up in your history.

That's because "!foo" or "bar!foo" are parsed as requests to substitute the most recent prior command that starts with "foo" in place of "!foo". Assuming you don't have such a command in your history this fails with an error about event not found. No command is generated, and so there is no attempt to run a command, and so nothing goes into history.

"foo!" on the other hand is parsed as an attempt to run the command "foo!". Command attempts do go into history.