{"id":15645976,"url":"https://github.com/zimbatm/shab","last_synced_at":"2025-04-30T11:22:00.457Z","repository":{"id":43212967,"uuid":"131022657","full_name":"zimbatm/shab","owner":"zimbatm","description":"the bash templating language","archived":false,"fork":false,"pushed_at":"2023-12-15T17:36:12.000Z","size":29,"stargazers_count":51,"open_issues_count":2,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-22T12:14:17.536Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zimbatm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-25T14:55:18.000Z","updated_at":"2024-11-05T00:26:07.000Z","dependencies_parsed_at":"2023-12-15T18:48:45.943Z","dependency_job_id":null,"html_url":"https://github.com/zimbatm/shab","commit_stats":{"total_commits":34,"total_committers":5,"mean_commits":6.8,"dds":0.4117647058823529,"last_synced_commit":"d210a0484b135216c8db55158ad4ee9cc76385d4"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zimbatm%2Fshab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zimbatm%2Fshab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zimbatm%2Fshab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zimbatm%2Fshab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zimbatm","download_url":"https://codeload.github.com/zimbatm/shab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251689009,"owners_count":21627815,"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":[],"created_at":"2024-10-03T12:10:47.760Z","updated_at":"2025-04-30T11:22:00.427Z","avatar_url":"https://github.com/zimbatm.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shab templating language\n\n[![Build Status](https://travis-ci.org/zimbatm/shab.svg?branch=master)](https://travis-ci.org/zimbatm/shab)\n\nOne day, @roberth and @zimbatm were tired of manually replacing variables with\nsed. What if they could just drop variables in the file and have bash do the\nsubstitution for them? Get the full power of the bash variable expansion,\nbrilliant!\n\nThus was born the shab templating language. Minimal size, maximum power\n(assuming bash is already installed).\n\n```\n$ wc -l shab\n24 shab\n```\n\n**SECURITY WARNING**: only use templates that you trust! The template really does\nhave all the power of a shell script.\n\n## Use cases\n\n* Configure a minimal docker container application during boot\n* Fullfill a weird sense of minimalism and humour\n\n## Example\n\nInput:\n```\n$ cat example.shab\nHello,\n\nthis is a shab templating example.\n\nUsage: ./shab example.shab\n\nYour hostname: $(hostname)\nYour user: ${USER:-unknown}\n```\n\nOutput:\n```\n$ shab example.shab\nHello,\n\nthis is a shab templating example.\n\nUsage: ./shab example.shab\n\nYour hostname: x1\nYour user: zimbatm\n```\n\n## Nix\n\nOf course you want to use this in your Nix expressions!\n\n```\nwith import \u003cnixpkgs\u003e { overlays = [ (import ./overlay.nix) ]; };\nshab.renderText\n  \"\\${GREETING}\\${TARGET:+, }\\${TARGET}\"\n  { GREETING = \"Hello\"; TARGET = \"world\"; }\n```\n\n## Docker\n\nUse our minimal enterprise-ready docker images with only bash and shab:\n\n```\n$ cat example.shab | docker run -i --rm zimbatm/shab\nHello,\n\nthis is a shab templating example.\n\nUsage: ./shab example.shab\n\nYour hostname: 706d660042c4\nYour user: unknown\n```\n\n## Template format\n\nBasically anything that bash can do.\n\n* [Variable expansion](https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html)\n* Capture program outputs with `$(...)`\n\n## Known issues\n\n* Shab always adds a newline to the input file. See [#15](https://github.com/zimbatm/shab/issues/15).\n\n## Dependencies\n\n* bash\n* cat\n\n## Related projects\n\n* envsubst from the gettext package\n* https://github.com/a8m/envsubst/ which is a go re-implementation of envsubst\n* manually replacing variables with sed\n* https://github.com/jirutka/esh - 160 LoC POSIX-sh and awk templating\n  language\n* https://github.com/dylanaraps/pure-bash-bible - a fun read about\n  implementing everything in pure bash\n\n## Credits\n\n* The authors of the UNIX V7 shell\n* Richard Stallman, GNU, and bash maintainers for their reimplementation\n* Our source of inspiration, [Rube Goldberg](https://en.wikipedia.org/wiki/Rube_Goldberg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzimbatm%2Fshab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzimbatm%2Fshab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzimbatm%2Fshab/lists"}