Skip to content

Commit

Permalink
Add runnable shell-script code block.
Browse files Browse the repository at this point in the history
  • Loading branch information
caiorss committed Oct 8, 2017
1 parent 2f1002f commit e3bee36
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
45 changes: 44 additions & 1 deletion Org-mode-recipes.org
Expand Up @@ -11,6 +11,50 @@
This section provides useful org-mode code blocks examples that can
used for literate programming and creating executable snippets.

** Example: Runnable shell-script code block

Code block source code

#+BEGIN_SRC org
,#+BEGIN_SRC sh :results verbatim :exports both
echo "Language LC_ALL = "$LC_ALL
echo "Kernel version = $(uname -r)"
echo "Hostname = $(hostanme)"
echo "Username = $(whoami)"
echo "Current Date = $(date)"
echo "Current directory = $(pwd)"
,#+END_SRC

,#+RESULTS:
: Language LC_ALL =
: Kernel version = 4.9.52-1-MANJARO
: Hostname =
: Username = archbox
: Current Date = Sun Oct 8 00:53:19 -03 2017
: Current directory = /home/archbox/Documents/projects/emacs
#+END_SRC

Code block - to run the code block, place the cursor within it and
type C-c C-c.

#+BEGIN_SRC sh :results verbatim :exports both
echo "Language LC_ALL = "$LC_ALL
echo "Kernel version = $(uname -r)"
echo "Hostname = $(hostanme)"
echo "Username = $(whoami)"
echo "Current Date = $(date)"
echo "Current directory = $(pwd)"
#+END_SRC

#+RESULTS:
: Language LC_ALL =
: Kernel version = 4.9.52-1-MANJARO
: Hostname =
: Username = archbox
: Current Date = Sun Oct 8 00:53:19 -03 2017
: Current directory = /home/archbox/Documents/projects/emacs


** Example: Runnable C++ Code block

Code block source
Expand Down Expand Up @@ -155,4 +199,3 @@ arg[2] = arg2
arg[3] = arg3

#+END_SRC

2 changes: 1 addition & 1 deletion README.org
@@ -1,7 +1,7 @@
# -*- mode: org; -*-
#+INCLUDE: theme/style.org
#+TITLE: Emacs In a Box
#+KEYWORDS: emacs, elisp, lisp, programming, eshell, editor
#+KEYWORDS: emacs, elisp, lisp, programming, eshell, editor, org-mode
#+STARTUP: content
#+DESCRIPTION: Emacs in self-contained box!

Expand Down

0 comments on commit e3bee36

Please sign in to comment.