2

What are the differences between shell-mode and shell-script-mode, or how/where would I read up the differences myself?

2
  • 5
    M-x describe-function RET shell-mode RET and M-x describe-function RET shell-script-mode RET say this very clearly (in vanilla emacs describe-function is bound to C-h f).
    – JeanPierre
    Commented Nov 29, 2016 at 10:09
  • What @JeanPierre said. Ask Emacs.
    – Drew
    Commented Nov 29, 2016 at 15:27

2 Answers 2

7

shell-mode is to run shell inside Emacs, shell-script-mode is a major mode for shell script editing.

See:

6

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.