Hi List, I'm having some trouble getting babel executed in Emacs and scripts that are tangled to behave the same. I think I've distilled it down to an MWE. I'd like to inject
#+NAME: table | 1 | 2 | | 3 | 4 | into a bash workflow where I need each of those 4 items with their respective row and column. That is, redefine the table so that it is: | x | y | z | | 0 | 0 | 1 | | 0 | 1 | 2 | | 1 | 0 | 3 | | 1 | 1 | 4 | I can do this in a babel block like this: #+NAME: import #+BEGIN_SRC sh :results output :tangle no :var table=table rm -f tmpfile lineno=0 echo "${table}" | while read line; do colno=0 echo ${line} | tr ' ' '\n' | while read entry; do echo $lineno "|" $colno "|" $entry >> tmpfile colno=$(( $colno + 1 )) done lineno=$(( $lineno + 1 )) done echo "" cat tmpfile #+END_SRC #+RESULTS: import : : 0 | 0 | 1 : 0 | 1 | 2 : 1 | 0 | 3 : 1 | 1 | 4 And I can call it with: #+CALL: import(table=table) And I get the results I want But when I tangle it out, the tangled file defines "table" like this: unset table declare -A table table['1']='2' table['3']='4' And then the algorithm does not work. Am I doing something incorrectly here with respect to executing babel blocks inside Emacs v. tangling to external files? Any suggestions how to get similar behavior inside emacs and outside emacs? Thanks, -k.