According to https://lists.gnu.org/archive/html/emacs-orgmode/2015-11/msg00425.html ob-sh was renamed ob-shell in org 8.2 ... and I cite from there:
org-babel-get-header was removed in 0d000f5 (babel: small change in
API., 2015-10-29), but the old ob-sh.el is still trying to call it.
That means you should replace (sh . t) by (shell . t) in your call of ...
There are multiple issues going on, which I will do my best to address in a language agnostic manner.
Short Generic Answer
Use org-babel-expand-src-block1 to preview code that will be executed in the temporary file.
Place cursor, i.e. the point, inside the code block on on the #+BEGIN_SRC line.
Press C-c C-v v to open new Org-Babel Preview buffer.
You can find out how your code is executed by checking ob-shell.el. As for your particular example, your code is passed to bash as stdin, something like the following
$ echo 'echo $VAR_DEFINED_IN_BASHRC' | bash
It will not work, you need the following instead
$ echo 'echo $VAR_DEFINED_IN_BASHRC' | bash -i
So you need to run bash interactively (-i) to ...
The function org-babel-expand-noweb-referenes will expand the <<noweb>> entries. You can call this function from another source block (use a :wrap header argument to make source the output is wrapped in an appropriate source block):
#+BEGIN_SRC elisp :exports none
Only if you use the header argument :results value the code of the block is wrapped by a function and the result of the code block is the return value of that function.
#+BEGIN_SRC python :exports both :results value
return 7 + 7
On the other hand :results output means that the code of the block is sent to the interpreter. The result of the code ...
Use org-sbe in :dir header to fetch the result from a named block.
Tip: Create dirB directory in same directory as the org-mode example file otherwise the pwd command will throw an error.
(format "%sdirB" (file-name-directory (buffer-file-name)))
Looks like it might be possible to achieve it by creating a helper lisp function:
#+begin_src emacs-lisp :results silent
(defun result1 ()
(setq value (org-babel-read-result))
You can "deactivate" a block with the :eval no header argument. You could also try to cache the results, using the :cache yes, which would not re-execute the block unless its contents has changed.
The rule is that if you want to specify header arguments for source blocks, then you need to use the various headers-args* properties: only those are consulted when a source block is executed.
You can define other properties like PRJ-DIR and tangle, as you did above. But unless you do something special with them, they will not affect the evaluation of a ...
You can use org-babel-execute:org from that answer. Just put it in your init file. I think a (require 'cl-lib) in front of it should make the code run in your init file.
Therewith executing an org source block will duplicate it with the header variables replaced by their values.
See the following example:
There are two options you could use, but I imagine that none are exactly what you want:
1) Create derived classes from the template classes
#+begin_src ruby :tangle ./app/models/appuser.rb
class AppUser < User
Braintree.api_key = "bk-54cfa45"
self.id = Braintree::...
By pass in target directory as path into Clojure code, and use java.io.File.renameTo to move generate plot image file to target dir.
Here is the complete story background: https://stardiviner.github.io/Blog/Clojure-Plotting-to-Org-inline-image-in-ob-clojure.html
Here is a complete example:
#+begin_src clojure :results file link :dir "data/images" :file "...