2

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.

1 Answer 1

3

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

When doing C-c C-c to attempt to run the code, the following message is produced:

Evaluation of this bash code block is disabled.
1
  • FWIW I experienced an issue where :noeval was not preventing the code block from executing for some odd reason. Switched to :eval no and it worked.
    – Chris
    Feb 10, 2022 at 18:01

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.