{"id":16696418,"url":"https://github.com/gbevan/yamlsh","last_synced_at":"2026-04-20T05:02:07.967Z","repository":{"id":64302813,"uuid":"138642041","full_name":"gbevan/yamlsh","owner":"gbevan","description":"YAML Parsed to environment variables in #! for shell","archived":false,"fork":false,"pushed_at":"2018-09-07T16:41:38.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T02:29:25.247Z","etag":null,"topics":["bash","golang","shebang","shell","yaml"],"latest_commit_sha":null,"homepage":"","language":"Go","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/gbevan.png","metadata":{"files":{"readme":"README.md","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":"2018-06-25T19:43:36.000Z","updated_at":"2024-08-23T10:05:36.000Z","dependencies_parsed_at":"2023-01-15T09:45:41.133Z","dependency_job_id":null,"html_url":"https://github.com/gbevan/yamlsh","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/gbevan/yamlsh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbevan%2Fyamlsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbevan%2Fyamlsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbevan%2Fyamlsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbevan%2Fyamlsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gbevan","download_url":"https://codeload.github.com/gbevan/yamlsh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbevan%2Fyamlsh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32033717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bash","golang","shebang","shell","yaml"],"created_at":"2024-10-12T17:28:28.205Z","updated_at":"2026-04-20T05:02:07.949Z","avatar_url":"https://github.com/gbevan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yamlsh - YAML Parsed in `#!` for shell\n\n(I'm sure there is already a util out there that does this (I couldn't find one,\nthough admittedly I didn't search very hard), but I'm learning the\nGo language and needed the practice, so...)\n\nParse a yaml file and pass as environment variables to a script from `#!`.\n\nYou can download a prebuilt binary from the project's releases page\n[here](https://github.com/gbevan/yamlsh/releases/latest).\n\n## Build and install\nRequires GOPATH setup and this project cloned out to `src/`\n```\ngo get github.com/golang/dep/cmd/dep\ndep ensure -v --vendor-only\ngo build \u0026\u0026 sudo cp yamlsh /usr/local/bin\n```\n\n## Usage\nTo use within a shell script replace the #! line with:\n```\n#!/usr/local/bin/yamlsh --yaml=${MYFILE}\n# ...rest of your script goes here...\n```\n`${MYFILE}` will be substituted with the environment variable `MYFILE`, e.g.:\n```\nMYFILE=test.yml ./test.sh\n```\nThe `test.sh` script and `test.yml` file produces this output:\n```\nIN SCRIPT\nYAMLSH_DICT1_NEST1_FloatNum=3.14\nYAMLSH_VAR1=my var 1\nYAMLSH_DICT1_NEST1_MultiLinePp=aaaaaaaaaaaaaaaaaaaaaa\\nbbbbbbbbbbbbbbbbbbbbbb\\ncccccccccccccccccccccc\\n\nYAMLSH_DICT1_NEST1_MultiLineGt=aaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccc\\n\nYAMLSH_DICT1_NEST1_ARRAY2_1=array\nYAMLSH_DICT1_NEST1_ARRAY2_0=an\nYAMLSH_DICT1_NEST1_Number=100\nYAMLSH_PREFIX=YAMLSH\nYAMLSH_DICT1_NEST1_NEST2=value of NEST2\nYAMLSH_ARRAY1_0=val1\nYAMLSH_ARRAY1_1=val2\n```\nAs can be seen, complex yaml structures are flattened for easy use in shell\nscripts.\n\nBy default variables passed are prefixed with `YAMLSH_`.  To change this use\nthe `YAMLSH_PREFIX` environment variable, e.g.:\n```\nMYFILE=test.yml YAMLSH_PREFIX=FOO ./test.sh\n```\nThe shell used defaults to `/bin/bash`, but you can override to use your\npreferred shell via environment variable `YAMLSH_SHELL`\n\nLikewise you can also set the YAML file to preload using environment\nvariable `YAMLSH_YAMLFILE`.  However, the `--yaml=file.yml` will take\nprecedence.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbevan%2Fyamlsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgbevan%2Fyamlsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbevan%2Fyamlsh/lists"}