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.
The lone !
at the start of a command negates the exit status of the command or pipeline: if the command exits 0
, it will flip into 1
(failure), and if it exits non-zero it will turn it into a 0
(successful) exit.
This use is documented in the Bash manual:
If the reserved word ‘!’ precedes the pipeline, the exit status is the logical negation of the exit status as described above.
A !
with no following command negates the empty command, which does nothing and returns true (equivalent to the :
command). It thus inverts the true to a false and exits with status 1, but produces no error.
There are also other uses of !
within the test
and [[
commands, where they negate a conditional test. These are unrelated to what you're seeing. In both your question and those cases it's not related to history expansion and the !
is separated from any other terms.
Best Answer
It is not an
ls
feature, it's abash
feature and it's described in the “Pattern Matching” section in bash(1):Your understanding is also not entirely correct –
?
means any single character, so the expressionx?[a-c]*
would matchxQcFoo.bar
,xmabc
andx1a
but alsoxabc
- the point is that{a,b,c}
may be also the second letter, not only the third. Output ofls x?[a-c]*
command will be a list of files that matchx?[a-c]*
pattern. Or, if there are no such files, the shell won't substitutex?[a-c]*
with anything, sols
will try to list the file literally namedx?[a-c]*
.