Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • That is absolutely fantastic! I had no idea -e is a thing. This even allows ctrl+arrow-key to skip words and keys like ESC or F-keys simply don't write anything now. One question about the history thing: How exactly does that work? I've never heard about this other than related to the .bash_history | I'm marking this as the accepted answer, even though it doesn't exactly filter escape sequences like asked, this is a way more elegant and compact solution. Commented Mar 24, 2020 at 19:53
  • 1
    @confetti It's the same mechanism as bash's regular command history, but it won't be loaded from or saved in .bash_history unless you do this explicitly with history -r and history -w respectively. If you do want to save the entry history between chat sessions, you could put them at the beginning and end of the script (but I'd recommend changing the HISTFILE variable to something other than ~/.bash_history, so the chat history doesn't get mixed with your command history). Commented Mar 24, 2020 at 20:06
  • That is amazing, thanks for teaching me something new and great. Commented Mar 24, 2020 at 20:28