From an answer to one my previous question I learned that shells (such as bash) have an ability not to follow the rules of terminal input processing set by
stty(1). In particular, they can operate in raw mode while there is a setting enabled that turns on canonical mode (
stty icanon) (with line discipline editing rules, and so on).
In this regard
- Is it correct to say that every running process (process group) can configure its own settings with respect to its terminal? In other words, there is no system-wide point of the settings of a
ttyinstance, it is all individual to every single process (process group). (So bash explicitly sets up raw mode before starting to read a command name.)
- What does
stty(1)exactly affect? My guess is this is a set of user preferences that is implemented by the terminal emulator with respect to the terminal used, which is a pty master side.
- When there are two sides communicating, bash on the slave one and the terminal emulator on master and they have set different tty configs (bash: "send me characters immediately, no line editing", the emulator: "send characters on EOL, line editing please"), why does the rules of bash win? What circumstances have an effect on such priority?
- If we run some
catcommand through bash it will obey the
stty(1)settings. So does it mean bash explicitly defaults to these before executing the program or they are "inherited" to
catin some other way?