Timeline for How to safely escape a variable string (user input) in bash?
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 24, 2020 at 20:28 | comment | added | confetti | That is amazing, thanks for teaching me something new and great. | |
| Mar 24, 2020 at 20:06 | comment | added | Gordon Davisson | @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). | |
| Mar 24, 2020 at 19:54 | vote | accept | confetti | ||
| Mar 24, 2020 at 19:53 | comment | added | confetti | 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. | |
| Mar 24, 2020 at 19:48 | history | answered | Gordon Davisson | CC BY-SA 4.0 |