In sh-mode in Emacs, I was looking for a way to execute a shell script in the current buffer directly like the C-c C-c in Python-mode. Using M-! is really tiring. Any amount of googling doesn't help. Is this possible?
so if you want to execute the whole buffer, C-x h M-| or you can rebind to something more convenient.
6
votes
When I am editing a shell script called foo.sh, I set the variable compile-command to "foo.sh". Then, C-c m (compile) or C-c r (recompile) executes the script. C-c m lets me add or modify arguments to the script before running it, C-c r will run it with the last arguments used.
1
votes
Rebind M-! to something you like better, you can do it to the local keymap to just affect the shell buffer.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more