I have some shell code that can be dangerous to run on local machine in a org-mode source code block. Globally, I have configured org-mode to prompt for execution, but I would still like to make sure that these blocks will NEVER be executed with per-block configuration.
To explicitly disable certain org-mode code blocks from execution, add
:eval no or
:noeval in the code block header line. See the example below:
#+begin_src bash :noeval sudo rm -rf / #+end_src
C-c C-c to attempt to run the code, the following message is produced:
Evaluation of this bash code block is disabled.
FWIW I experienced an issue where
:noevalwas not preventing the code block from executing for some odd reason. Switched to
:eval noand it worked.– ChrisFeb 10, 2022 at 18:01