Occasionally, emacs opens a file in
shell-script[fish] when I want it to open in
shell-script[bash]. How can I manually change the subtype of shell-script mode that I'm in?
What is determining whether you see
shell-script[bash] is probably:
The extension of the file (
*.shfiles will probably open with
*.fishfiles will probably open with
The starting #!-line (e.g., if the first line of the file you are opening is
#!/bin/bash, it should start in
I am not sure in your case what is causing your files to open in different submodes (if you provide further detail in your question I will update my answer if necessary), but if you want to be able to manually switch between submodes as you say, you can do so with the command
M-x sh-set-shell (for me it is bound to
C-c :) and then select your desired shell from a list of completions or type it in yourself. It should also update the #!-line of whatever script you are editing.