←back to thread

217 points tanelpoder | 3 comments | | HN request time: 0.607s | source
1. fouric ◴[] No.26492914[source]
If you could configure the common shells (bash, zsh, fish) to run a custom command on submitted shell input before executing, you could build a heuristic function that would attempt to recognize when you were pasting in a prompt. Unfortunately, I'm not aware of such a capability, as it would be useful in a number of situations.

Another alternative is to put the octothorpe # at the beginning of your prompt - then you can keep your > at the end.

replies(2): >>26493527 #>>26494355 #
2. vlovich123 ◴[] No.26493527[source]
I recall terminals (MacOS Terminal? definitely Konsole seems to) that prevent any paste from actually executing the command, even if it contains newlines. Doesn't that solve this problem?
3. Symmetry ◴[] No.26494355[source]
Fish just doesn't seem to process the redirected output to clobber the file when a command isn't found. If your prompt is a valid command it can clobber a binary but not otherwise, apparently.