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.
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:
'((shell . t)))
No need for "copy-n-paste", just do C-c C-c where you have your
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.
while [ $n -le 10 ]; do
n=$(( n + 1 ))