Hello,
William Denton <[email protected]> writes:
> On 3 April 2021, Greg Minshall wrote:
>
>> #+begin_src shell :results output :var n=numbers
>> echo ${n[1]}
>> #+end_src
>
> Aha, it's in an array but I didn't see it! Thanks. Org was doing it magic
> but
> I got confused by bash.
interestingly I asked a similar question in #org-mode yesterday. I came
up with this approach:
* table test
** user data
#+name: userdata
| uid | name | foo | bar |
| a2s | a2 | afoo | abar |
| b2s | b2 | bfoo | bbar |
| c2s | c2 | c foo | cbar |
** code
#+begin_src sh :var userdata=userdata :separator , :results raw
echo "$userdata" | while read line ; do
IFS=','
echo "$line" | while read u n f b ; do
echo "u: $u n: $n f: $f b: $b"
done
done
#+end_src
This looks a bit clumsy, but should also work with shell that doesn't
support (2D) array type variables.
Regards
hmw