Shell Terminology – What is an Interactive Shell?

shell

UNIX: The Complete Reference, Second Edition
by Kenneth H. Rosen et al.

You can start another shell after you log in by using the name of the
shell as a command; for example, to start the Korn shell, you could
type ksh at the command prompt. This type of shell is not a login
shell, and you do not have to log in again to use it, but it is still
an interactive shell, meaning that you interact with the shell by
typing in commands (as opposed to using the shell to run a script, as
discussed in Chapter 20). The instances of the shell that run in a
terminal window when you are using a graphical interface are also
interactive non-login shells. When you start a non-login shell, it
does not read your .profile, .bash_profile, or .login file (or your
.logout file), but it will still read the second shell configuration
file (such as .bashrc). This means that you can test changes to your
.bashrc by starting another instance of the shell, but if you are
testing changes to your .profile or .login, you must log out and then
back in to see the results.

I was going through above lines and I don't understand what it means by interactive shell.
Is it true that .profile is not read if I am using terminal?

Moreover, what does it mean when you say that bourne is not is an interactive shell while bash/csh is an interactive shell?

Best Answer

An interactive shell is simply any shell process that you use to type commands, and get back output from those commands. That is, a shell with which you interact.

So, your login shell is interactive, as are any other shells you start manually, as described in the excerpt you quoted in your question. By contrast, when you run a shell script, a non-interactive shell is started that runs the commands in the script, and then exits when the script finishes.

The Bourne shell can be used as an interactive shell, just like bash or tcsh. In fact, many systems, such as FreeBSD, use sh as the default user shell. Modern shells like bash, zsh, tcsh, etc have many features that Bourne shell doesn't have, that make them more comfortable and convenient for interactive use (command history, completion, etc).

Interactive non-login shells (that is, shells you start manually from another shell or by opening a terminal window) don't read your .login or .profile files. These are only read and executed by login shells (shells started by the login system process, or by your X display manager), so the commands and settings they contain are only applied once, at the beginning of your login session. So, when you start a terminal, the shell that it spawns for you does not read your login files (.login for c-style shells, .profile for bourne style shells), but it does read the .cshrc, .bashrc etc files.

Related Question