Sample Header Ad - 728x90

When does history expansion happen in bash?

1 vote
2 answers
2378 views
When does history expansion happen? 1. From bash manual > Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’. Since double quotes are recognized at parsing stage by the parser, is it correct that history expansion must happen after parsing? If yes, when does it happen with respect to shell expansions such as brace expansion, parameter expansion, filename expansion, etc? 2. But I think that history expansion is provided by the readline of the shell, so is processed before lexical analysis and parsing? Just like auto-completion in shell. Am I missing something? Thanks.
Asked by Tim (106430 rep)
May 20, 2018, 09:51 PM
Last activity: Feb 2, 2021, 12:12 PM