Search notes:

shell

fc
Bash: for
history
Bash: if
Bash - shopt
Bash: while
readline

Determine if a command is available

if command -v make > /dev/null 2>&1; then
   echo make is available
else
   echo make is not available
fi

Interactive vs non-interactive

An interactive shell accepts input that is typed on a keyboard.
a non-interactive shell executes commands that are stored in a file.

Login shells

Interactive login shells are started after a successful login (or with bash -l).
If this interactive login shell is Bash, it normally reads /etc/profile and ~/.bash_profile (if available).
The default login shell can be changed with chsh
At least, in bash, if a shell is a login shell can be determined with shopt login_shell.
/etc/shells contains a list of allowed login shells on the system.
When a bash login shell is terminated, bash sources ~/.bash_logout.

Interactive non login shells

An interactive non login shell is usually started from an other login or non-login shell with /bin/bash or su, xterm or konsole.

Non-interacive shells

A non-interactive shell processes the contents of a shell script. It is non-interactive because it doesn't have to wait for input from a user.

TODO

Comments in here documents

Apparently, a clever use of a here document can be used to block comment code in a shell script:
#!/bin/sh

echo before DOC

: <<'DOC'

  This text is apparently not run by the
  shell interpreter. Therefore, it can
  be used like documentation

DOC

echo after DOC
See this stackoverflow answer for more details.

See also

ISO 9949 defines a standard operating system interface and environment, including a command interpreter (aka shell) and common utility programs to support applications portability at the source code level.
bash, PS1, PROMPT_DIRTRIM
shell script
Process substitution
~/.profile
The SpiderMonkey JavaScript shell

Index