Skip to content

szanni/esh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESH(1)

NAME

esh - embedded shell

SYNOPSIS

esh [-s token] [-e token] [file]

DESCRIPTION

esh is a templating engine for evaluaing shell commands embedded in arbitrary templates.

Lines between the start and end token are evaluated by the shell. A start token followed by a = is syntactic sugar for echo, printing the following contents.

Like many other templating engines esh supports a front matter section for defining variables. This section is enclosed by two freestanding lines containing --- at the beginning of the file.

esh will default to reading from stdin if no file parameter is given and prints the result to stdout.

OPTIONS

-s

Start token, defaults to <%

-e

End token, defaults to %>

EXIT STATUS

0

Success

2

Failure (illegal parameter; file not found; syntax error within the template/embedded shell).

EXAMPLES

Example of an html template displaying the current directory contents in a list.

example.html.esh
<!DOCTYPE html>
<html>
<body>
  <ul>
  <% for i in $(ls); do %>
    <li><%= $i %></li>
  <% done %>
  </ul>
</body>
</html>

To generate the resulting html run:

esh example.html.esh > example.html

Another example showing the esh front matter capabilities.

example.html.esh
---
title="Test" # Make sure to use valid shell assignments!
---
<!DOCTYPE html>
<html>
<body>
  <h1><%= $title %></h1>
  <ul>
  <% for i in $(ls); do %>
    <li><%= $i %></li>
  <% done %>
  </ul>
</body>
</html>

SEE ALSO

sh(1)