Other org babel tangle example

Does anyone have an example of an org babel tangle file for creating a shell script?

In case you have never come across org babel tangle, it is some emacs method of documenting a program as an org document and automatically creating and executable from it by some magic.

 
Does anyone have an example of an org babel tangle file for creating a shell script?
Add the following code to a file with a .org extension:
Code:
#+begin_src sh :results output
  echo PID: "$$"
#+end_src
Then place your cursor within the code and hit C-c C-c. You should see the result (the PID of your current process) output into a section in the same file called #+RESULTS:

More information and examples can be found at this page.

EDIT: Forgot to mention that you need to switch on Org Babel functionality by adding the following code to your init.el:
Code:
;; activate Babel languages
(org-babel-do-load-languages
'org-babel-load-languages
'((shell . t)))
 
Add the following code to a file with a .org extension:
Code:
#+begin_src sh :results output
  echo PID: "$$"
#+end_src
Then place your cursor within the code and hit C-c C-c. You should see the result (the PID of your current process) output into a section in the same file called #+RESULTS:

More information and examples can be found at this page.
I'm sure this will be useful once I get used to it, but at the moment it just looks like babble :)

EDIT: Forgot to mention that you need to switch on Org Babel functionality by adding the following code to your init.el:
Code:
;; activate Babel languages
(org-babel-do-load-languages
'org-babel-load-languages
'((shell . t)))
It looks like I don't need this in Doom emacs.

If you could post some more examples that would be useful.
 
Back
Top