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*

8
  • Absolutely agreed it would be a ridiculous thing to do. My concept of "interactive," as I mentioned, is that it's just a collection of default behaviors which are useful when you are interacting with your shell. If you can change each one of those behaviors individually, and you do change each one, then the question "Is it still an interactive shell?" is just ridiculous semantics; it's not even an important question. However.... Commented Jan 23, 2017 at 12:08
  • 1
    @Wildcard, if you do exec < <(sleep infinity) in an interactive shell, you've got an interactive shell that is not very interactive. The shell would still consider itself interactive in that $- would still contain i, but you might not. I'm not sure there's much more to discuss about it. Commented Jan 23, 2017 at 12:17
  • 2
    @Wildcard, if the shell was started as interactive, it remains so. The fact that you could do set +i in older bash versions was a bug. Commented Jan 23, 2017 at 12:20
  • 1
    @Wildcard, If you look at the source code of bash, you'll probably find there's a interactive global boolean variable that maps to the i flag of $-. Changing that boolean will not automatically change all the behaviours of interactive shells. The changing from interactive to non-interactive is not supported. Commented Jan 23, 2017 at 12:44
  • 4
    @Wildcard Dash accepts set +i and stops displaying a prompt. This is something that the user isn't supposed to do, so it isn't surprising that the behavior depends on the shell and is often accidental rather than the result of a deliberate decision by the shell implementer. Commented Jan 24, 2017 at 23:22