{"id":13587560,"url":"https://github.com/jirutka/esh","last_synced_at":"2025-06-13T21:39:14.086Z","repository":{"id":26891963,"uuid":"110907117","full_name":"jirutka/esh","owner":"jirutka","description":"Simple templating engine based on shell.","archived":false,"fork":false,"pushed_at":"2025-05-18T16:11:21.000Z","size":53,"stargazers_count":224,"open_issues_count":4,"forks_count":17,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-08T01:27:51.786Z","etag":null,"topics":["awk","posix-sh","shell","template-engine"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jirutka.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-16T01:29:14.000Z","updated_at":"2025-05-27T02:02:35.000Z","dependencies_parsed_at":"2022-07-27T08:52:28.270Z","dependency_job_id":null,"html_url":"https://github.com/jirutka/esh","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jirutka/esh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fesh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fesh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fesh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fesh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jirutka","download_url":"https://codeload.github.com/jirutka/esh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fesh/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259724527,"owners_count":22902107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["awk","posix-sh","shell","template-engine"],"created_at":"2024-08-01T15:06:15.969Z","updated_at":"2025-06-13T21:39:14.051Z","avatar_url":"https://github.com/jirutka.png","language":"Shell","readme":"= ESH – Embedded SHell\n:source-language: sh\n:script-name: esh\n:script-sha1: 9084e3e8e70e4ea81c40cd1cf85559196c0fa2cc\n:gh-name: jirutka/{script-name}\n:version: 0.3.2\n\nifdef::env-github[]\nimage:https://github.com/{gh-name}/workflows/CI/badge.svg[Build Status, link=https://github.com/{gh-name}/actions?query=workflow%3A%22CI%22]\nendif::env-github[]\n\n*esh* (embedded shell) is a templating engine for evaluating shell commands embedded in arbitrary templates.\nIt’s like ERB (Embedded RuBy) for shell, intended to be used for templating configuration files.\nUnlike ERB it provides support for including one ESH template into another (since version 0.2.0).\n\nThe template processing consists of two phases: conversion to a shell script and evaluation of that script.\nYou can even run just the conversion phase: `esh -d` will dump a shell script that you can execute directly by a shell (even on a system without `esh` installed).\nHowever, in that case, you will not get error messages source-mapped to point to the locations in the template file.\n\nesh is implemented in ~290 lines (LoC) of shell and awk.\n\n\n== Requirements\n\n* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html[POSIX-sh] compatible shell (e.g. Busybox ash, dash, ZSH, bash, …)\n* common Unix userland with `awk` and `sed` (e.g. from Busybox, GNU, …)\n* (https://github.com/asciidoctor/asciidoctor[Asciidoctor] to build a man page)\n\n\n== Installation\n\nimage::https://repology.org/badge/vertical-allrepos/esh-shell-template-engine.svg?columns=4[Packaging status, align=center, link=https://repology.org/project/esh-shell-template-engine/versions]\n\n\n=== Alpine Linux\n\nInstall package *{script-name}* from the Alpine’s community repository:\n\n[source, subs=\"+attributes\"]\napk add {script-name}\n\n\n=== Fedora\n\n[source, subs=\"+attributes\"]\ndnf install {script-name}\n\n\n=== Void Linux\n\n[source, subs=\"+attributes\"]\nxbps-install {script-name}\n\n\n=== On CI\n\nYou can add {script-name} as a submodule into your repository or download it on demand, e.g.:\n\n[source, subs=\"+attributes\"]\nwget https://raw.githubusercontent.com/{gh-name}/v{version}/{script-name} \\\n    \u0026\u0026 echo '{script-sha1}  {script-name}' | sha1sum -c \\\n    || exit 1\n\n\n=== Manually\n\n. Download and unpack release tarball:\n[source, subs=\"+attributes\"]\nwget https://github.com/{gh-name}/archive/v{version}/{script-name}-{version}.tar.gz\ntar -xzf {script-name}-{version}.tar.gz\ncd {script-name}-{version}\n\n. Run tests:\n[source]\nmake test\n\n. Build a man page and install esh:\n+\n[source]\nmake install prefix=/usr/local DESTDIR=/\n+\nor just copy `esh` whether you want, it’s a plain shell script.\n\n\n== Usage\n\nRead man page link:{script-name}.1.adoc[{script-name}(1)].\n\n\n== Examples\n\n[source, nginx]\n----\nhttp {\n    access_log \u003c%= $logs_dir/access.log %\u003e main;\n\n    resolver \u003c%= $(sed -En 's/^nameserver ([^#]+)/\\1/p' /etc/resolv.conf) %\u003e;\n\n    \u003c% if nginx -V 2\u003e\u00261 | grep -q lua-nginx-module; then -%\u003e\n    lua_package_path '\u003c%= $(pkg-config --variable=INSTALL_LMOD lua) %\u003e/?.lua';\n    \u003c% fi -%\u003e\n\n    \u003c%+ ./http-common.esh %\u003e\n\n    \u003c%# The rest of the config is omitted %\u003e\n}\n----\n\n\n== Credits\n\nESH template syntax is based on ERB (Embedded Ruby).\n\nTests and some concepts are inspired by https://github.com/jwilk/shellcat[shellcat].\n\n\n== License\n\nThis project is licensed under http://opensource.org/licenses/MIT/[MIT License].\nFor the full text of the license, see the link:LICENSE[LICENSE] file.\n","funding_links":[],"categories":["General Purpose Preprocessor","Shell","shell","Shell Script Development"],"sub_categories":["Snippets Manager","Directory Navigation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjirutka%2Fesh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjirutka%2Fesh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjirutka%2Fesh/lists"}