hymie! writes:
I'd like to be able to have a series of commands in my raw org
file that I can copy-n-paste into my shell window. But I also
like to export my org files to HTML so that I can make ePubs and
keep them in my iPad.
And this
#+BEGIN_SRC
command1
command2
command3
#+END_SRC
is just IMO ugly.
It shouldn't be. Try adding the word "shell" after BEGIN_SRC, so
that it fontifies the code correctly (the variable
org-src-fontify-natively should be set to t, but that has been
default for a while). Also, add shell to the loaded babel
languages, so that you can execute the code and get the results
right away in org:
#+BEGIN_SRC emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((shell . t)))
#+END_SRC
No need for "copy-n-paste", just do C-c C-c where you have your
commands.
Another added benefit is that it is way easier to add the shell
scripts inside a SRC block after you press C-c ' (C-c ' again to
go back to your org file), since then you will have the power of
Shell-script mode available, for example:
C-c ( to define a function
C-c TAB for an if statement
C-c C-l for an indexed loop
Try copying this example into an org file, it should fontify it
nicely, both in the org file and in the html exported.
#+BEGIN_SRC shell
echo "hello"
cd
ls
n=1
while [ $n -le 10 ]; do
echo $n
n=$(( n + 1 ))
done
echo "bye"
#+END_SRC
Best,
--
Jorge.