"Phil Mason" <phil.ma...@broadcom.com> writes: > Hello all, > > If I evaluate the following source block in emacs 23.1.1, org mode > v7.8.03 it reports that it produces no output: > > #+begin_src sh :results replace > foo=1 > if [[ -n "$foo" ]]; then > echo "foo has been defined (and has value $foo)" > else > echo "foo has not been defined" > fi > if [[ -n "$bar" ]]; then > echo "bar has been defined (and has value $bar)" > else > echo "bar has not been defined" > fi > #+end_src > > Confusingly if I remove either if block then the results for the > remaining one is correct and if I run the same code from within an > actual script it works as I expect (foo is defined, bar is not). Can > anybody provide any clues about what I'm doing wrong. > > Thanks in advance >
I believe adding :results output should fix this problem, as what you want is a collection of the text printed to STDOUT. With that change I get the following... #+begin_src sh :results replace output foo=1 if [[ -n "$foo" ]]; then echo "foo has been defined (and has value $foo)" else echo "foo has not been defined" fi if [[ -n "$bar" ]]; then echo "bar has been defined (and has value $bar)" else echo "bar has not been defined" fi #+end_src #+RESULTS: : foo has been defined (and has value 1) : bar has not been defined > > Phil > > -- Eric Schulte http://cs.unm.edu/~eschulte/