What are the differences between shell-mode and shell-script-mode, or how/where would I read up the differences myself?
2 Answers
shell-mode
is to run shell inside Emacs, shell-script-mode
is a major mode for shell script editing.
See:
shell-mode
is used by the interactive shell (command line) environment started by the shell
command (spc : shell
, or M-x shell
in regular Emacs). It is a variant of the comint mode, which sends lines of interactive input to an external ("inferior") program -- like a lisp repl, python shell, ..., or your system shell in this case -- and puts its output back into the emacs buffer. In other word, it works like a simple terminal emulator.
Shell script mode (sh-mode
) is for editing files that contain shell script, as the name indicates. It contains the syntax highlighting and indentation rules, and at least for regular emacs the keyboard shortcuts, to make editing these scripts more comfortable.
Shell scripts are little programs interpreted by the shell, like at startup, or when you want to automate things. They contain the same commands and control structures that you can also type on the command line.
M-x describe-function RET shell-mode RET
andM-x describe-function RET shell-script-mode RET
say this very clearly (in vanilla emacsdescribe-function
is bound toC-h f
).