No, < <
and <<
are not the same thing.
The first is composed of the common <
redirection character combined with the first character of the <(command)
syntax. This is a ksh
construct (also found in bash
and zsh
) known as process substitution that takes the output of command
and provides it in a file whose name refers to the other end of the pipe command
is writing to.
In other word you can think of < <(command)
as < file
, where file contains the output of command
.
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.
Best Answer
${line#*'Caused By'}
is a specific instance of the variable substitution${parameter#word}
(as it's written in thebash
manual, and also in the POSIX standard for thesh
shell).In
${parameter#word}
, the patternword
will be removed from the beginning of the value of$parameter
. It's called "Remove Smallest Prefix Pattern" because it will remove the shortest matching prefix string that matches the pattern inword
(with##
in place of#
it removes the longest matching prefix string).It this specific example, the string
Caused by
(and anything before it, thanks to the*
) is, if it exists, removed from the value of$line
. The single quotes around the string are redundant.By comparing the result of the substitution with the value of the variable itself, the test determines whether the value of
$line
contains the textCaused by
, and printsYes
if it does.This has the same effect as
in
bash
,ksh93
orzsh
, orin any
sh
shell.The loop in the question reads "lines" from standard input. See the question "Understanding "IFS= read -r line" " for a discussion about this.