all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 825e17d2cfe5e37b656fce688144d9f1a6a4fcb0 6829 bytes (raw)
name: org-contrib/babel/languages/ob-doc-shell.org 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
 
#+OPTIONS:    H:3 num:nil toc:2 \n:nil ::t |:t ^:{} -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc broken-links:nil
#+STARTUP:    align fold nodlcheck hidestars oddeven lognotestate hideblocks
#+SEQ_TODO:   TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
#+TAGS:       Write(w) Update(u) Fix(f) Check(c) noexport(n)
#+TITLE:      Shell Code Blocks in Babel
#+AUTHOR:     Matt Trzcinski
#+EMAIL:      matt[at]excalamus[dot]com
#+LANGUAGE:   en
#+HTML_LINK_UP:    index.html
#+HTML_LINK_HOME:  https://orgmode.org/worg/
#+EXCLUDE_TAGS: noexport

# TODO remove this
#+options: toc:nil

#+name: banner
#+begin_export html
<div id="subtitle" style="float: center; text-align: center;">
  <p>
    Babel shell support, including: <a href="https://www.gnu.org/software/bash/">sh</a>,
    <a href="https://www.gnu.org/software/bash/">bash</a>,
    <a href="https://www.zsh.org/">zsh</a>,
    <a href="https://fishshell.com/">fish</a>,
    <a href="https://www.grymoire.com/unix/csh.html">csh</a>,
    <a href="https://www.in-ulm.de/~mascheck/various/ash/">ash</a>,
    <a href="http://gondor.apana.org.au/~herbert/dash/">dash</a>,
    <a href="http://www.kornshell.org/">ksh</a>,
    <a href="https://www.mirbsd.org/mksh.htm">mksh</a>, and
    <a href="https://packages.qa.debian.org/p/posh.html">posh</a>.
  </p>
  <p>
    <a href="https://www.gnu.org/software/bash/"><img width="180px"
    src="https://tiswww.case.edu/php/chet/img/bash-logo-web.png"/></a>
    
    <a href="https://www.zsh.org/"><img width="150px"
    src="https://zsh.sourceforge.io/Images/wizard.gif"/></a>

    <a href="https://www.mirbsd.org/mksh.htm"><img width="150px"
    src="https://www.mirbsd.org/pics/logo-grey.png"/></a>
    
    <a href="https://fishshell.com/"><img width="150px"
    src="https://fishshell.com/assets/img/Terminal_Logo2_CRT_Flat.png"/></a>
    
    <a href="http://www.kornshell.org/"><img width="180px"
    src="http://www.kornshell.org/kornshell.gif"/></a>

  </p>
</div>
#+end_export

* Template Checklist [4/12]                                        :noexport:
  - [X] Revise #+TITLE:
  - [X] Indicate #+AUTHOR:
  - [X] Add #+EMAIL:
  - [X] Revise banner source block [3/3]
    - [X] Add link to a useful language web site
    - [X] Replace "Language" with language name
    - [X] Find a suitable graphic and use it to link to the language
      web site
  - [ ] Write an [[Introduction]]
  - [ ] Describe [[Requirements and Setup][Requirements and Setup]]
  - [ ] Replace "Language" with language name in [[Org Mode Features for Language Source Code Blocks][Babel Features for Language Source Code Blocks]]
  - [ ] Describe [[Header Arguments][Header Arguments]]
  - [ ] Describe support for [[Sessions]]
  - [ ] Describe [[Result Types][Result Types]]
  - [ ] Describe [[Other]] differences from supported languages
  - [ ] Provide brief [[Examples of Use][Examples of Use]]
* Introduction
# - Brief description of language.
A shell is a user interface for interacting with system services.
File management, process execution, and operating system monitoring
can all be done with a shell. Many shells are plain text only whereas
some support graphics or are themselves fully graphical. Similarities
exist between shells and, though standards exist (such as
POSIX[fn:1]), there is no guarantee that what works in one shell will
work in another. Each shell is a separate application.

Shells often provide a programming language as well as access to
system utilities, such as the GNU Core Utilities[fn:2]. Users can
stitch utilities together or create their own.

# - Range of typical uses within Org Mode.
Org Babel lets users run commands[fn:3] in separate shells...

: #+begin_src sh :results output
:   echo PID: $$
: #+end_src
: 
: #+RESULTS:
: : PID: 9952
: 
: #+begin_src sh :results output 
:   echo PID: $$
: #+end_src
: 
: #+RESULTS:
: : PID: 9990
: 
...or as part of a shared session.

: #+begin_src sh :results output :session shared
:   echo PID: $$
:   export X=1
: #+end_src
: 
: #+RESULTS:
: : PID: 9742
: 
: #+begin_src sh :results output :session shared
:   echo PID: $$
:   echo X was set to $X
: #+end_src
: 
: #+RESULTS:
: : PID: 9742
: : X was set to 1

Shell blocks can run as standalone scripts or chained processes, be
tangled, use args, work with stdin, have shebangs, and more.
    
* Requirements and Setup
# - Installation and configuration of language software
Org Babel can run many different shells, including [[https://www.gnu.org/software/bash/][sh]], [[https://www.gnu.org/software/bash/][bash]], [[https://www.zsh.org/][zsh]],
[[https://fishshell.com/][fish]], [[https://www.grymoire.com/unix/csh.html][csh]], [[https://www.in-ulm.de/~mascheck/various/ash/][ash]], [[http://gondor.apana.org.au/~herbert/dash/][dash]], [[http://www.kornshell.org/][ksh]], [[https://www.mirbsd.org/mksh.htm][mksh]], and [[https://packages.qa.debian.org/p/posh.html][posh]].  The primary requirement is
that the shell be installed on the system.

# - Emacs configuration
# - Org-mode configuration (org-babel-do-load-languages)
Once the shell is installed on the system, the Org Babel shell
language facility must be set to load[fn:4]:

#+begin_example emacs-lisp
;; active Babel languages
(org-babel-do-load-languages
 'org-babel-load-languages
 '((shell . t)))
#+end_example

*NOTE:* This is all that's needed, regardless of the shell you intend
to use! The "shell" <lang> loads functionality for /all/ supported
shells.  The car of =(shell . t)=, namely "shell", is the name of the
Org Babel module that handles it, =ob-shell.el=.

*NOTE:* The =ob-shell.el= module used to be named =ob-sh.el=. This was
changed in Org 8.2[fn:5].

* Babel Features for Language Source Code Blocks
** Header Arguments
   - Language-specific default values
   - Language-specific header arguments
** Sessions
   - Support or not
   - Typical use for sessions
** Result Types
   - Which result types are supported?
** Other
   - Differences from other supported languages
* Examples of Use
  - Hello World!
  - Common uses
  - Links to tutorials and other resources

* Footnotes

[fn:1] https://opensource.com/article/19/7/what-posix-richard-stallman-explains

[fn:2] https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands

[fn:3] https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-_0024_0024

[fn:4] https://orgmode.org/worg/org-contrib/babel/languages/index.html#configure

[fn:5] https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/etc/ORG-NEWS#n3995 

#+begin_example
,* Version 8.2

,** Incompatible changes
,*** =ob-sh.el= renamed to =ob-shell=
This may require two changes in user config.

1. In =org-babel-do-load-languages=, change =(sh . t)= to =(shell . t)=.
2. Edit =local.mk= files to change the value of =BTEST_OB_LANGUAGES=
   to remove "sh" and include "shell".
#+end_example

debug log:

solving 825e17d2 ...
found 825e17d2 in https://yhetil.org/emacs/17dcc5a0e3e.d8ca0ef6361712.4976360594738663013@excalamus.com/
found 46ce0a6f in https://yhetil.org/emacs/17d4b19ca71.ac420620285921.855633753289808327@excalamus.com/ ||
	https://yhetil.org/emacs/17dcc5a0e3e.d8ca0ef6361712.4976360594738663013@excalamus.com/

applying [1/2] https://yhetil.org/emacs/17d4b19ca71.ac420620285921.855633753289808327@excalamus.com/
diff --git a/org-contrib/babel/languages/ob-doc-shell.org b/org-contrib/babel/languages/ob-doc-shell.org
new file mode 100644
index 00000000..46ce0a6f

Checking patch org-contrib/babel/languages/ob-doc-shell.org...
Applied patch org-contrib/babel/languages/ob-doc-shell.org cleanly.

skipping https://yhetil.org/emacs/17dcc5a0e3e.d8ca0ef6361712.4976360594738663013@excalamus.com/ for 46ce0a6f
index at:
100644 46ce0a6f2d0015b2a96e35d6c9b503288a97f1b5	org-contrib/babel/languages/ob-doc-shell.org

applying [2/2] https://yhetil.org/emacs/17dcc5a0e3e.d8ca0ef6361712.4976360594738663013@excalamus.com/
diff --git a/org-contrib/babel/languages/ob-doc-shell.org b/org-contrib/babel/languages/ob-doc-shell.org
index 46ce0a6f..825e17d2 100644

1:45: trailing whitespace.
    
1:51: trailing whitespace.
    
1:54: trailing whitespace.
    
1:86: trailing whitespace.
: 
1:89: trailing whitespace.
: 
Checking patch org-contrib/babel/languages/ob-doc-shell.org...
Applied patch org-contrib/babel/languages/ob-doc-shell.org cleanly.
warning: squelched 8 whitespace errors
warning: 13 lines add whitespace errors.

index at:
100644 825e17d2cfe5e37b656fce688144d9f1a6a4fcb0	org-contrib/babel/languages/ob-doc-shell.org

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.