1

This question might seem silly but i ran into it when trying to understand how to upgrade a dumb shell over a netcat connection.

To be more specific i'm talking about the reason that causes specific keystrokes to provoke a certain behaviour in the shell such as : arrow up = previous command, arrow left = move 1 to the left, clear = clean the screen etc ...

1
  • man readline should get you started
    – Panki
    Commented Nov 12, 2020 at 10:14

1 Answer 1

0

For bash, the man page says:

INVOCATION

   A login shell is one whose first character of argument zero is a -, or one
   started with the --login option.

   An interactive shell is one started without non-option arguments (unless -s is
   specified) and without the -c option whose standard input and error are both
   connected to terminals (as determined by isatty(3)), or one started with the -i
   option.  PS1 is set and $- includes i if bash is interactive, allowing a shell
   script or a startup file to test this state.

In startup files for several shells, you may see tests for interactive-ness as something like:

if [ "$PS1" ]; then
# set up for interactive use
fi
1
  • Yes I'm afraid that I already know this bit, but that doesn't really answer my question, which is exactly what in the OS is responsible of translating specific input commands (e.g arrow up, arrow left etc...) into a specific behavior (e.g previous command, move cursor left etc...), and i suspect it must be on the terminal side, not the shell.
    – Segfault
    Commented Nov 12, 2020 at 2:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .