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
  • This question is also discussed at some length in chat. Commented Jan 23, 2017 at 12:25
  • Perhaps we can just declare that "has i in the value of $-" is the definition of shell interactiveness, and thus it is the source of truth. Then the first answer to "where is it stored" would be in $- and the answer to "can a shell become interactive or vice versa" is yes, clearly. Now that simplifies your questions but then makes the definition of "interactive" more complex. But beyond the implications in the shell itself, maybe its definition is simply intent. Processes invoked by a (non)interactive shell should attempt to respect that intent though it may not be technically enforced. Commented Mar 12, 2022 at 6:18
  • Also, if you have a C program (for example) and its executed from an interactive prompt, how can that program get the value of $-? How are we supposed to know that intent from a non-shell program? Is that stored in a flag somewhere on the process? Commented Mar 12, 2022 at 6:20