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.

Required fields*

3
  • That will only work in shell functions, or if the script was sourced (. foo.sh or `source foo.sh, instead of run in a subshell.) Interesting approach, though. A similar hack that requires modifying the context of the calling shell would be to set up a custom completion that expanded the empty line to something, and then restored the old completion handler. Commented Jul 6, 2015 at 1:01
  • @PeterCordes you are right. I was taking the question too literally. But I've added an example of a simple script that could work. Commented Jul 6, 2015 at 6:36
  • @mikeserv Hey, its just a simple solution that may be useful to some people. You can even remove the eval if you have simple commands to edit, without pipes and redirection etc. Commented Jul 6, 2015 at 7:40