{"id":20796591,"url":"https://github.com/the-common/bash-script-templates","last_synced_at":"2026-04-19T21:02:21.311Z","repository":{"id":150229643,"uuid":"486311735","full_name":"the-common/bash-script-templates","owner":"the-common","description":"(MIRRORED FROM GITLAB) Ready-to-use bash shell script templates at your fingertips!","archived":false,"fork":false,"pushed_at":"2024-05-16T16:49:34.000Z","size":65,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T11:28:49.625Z","etag":null,"topics":["bash","scripting","templates"],"latest_commit_sha":null,"homepage":"https://gitlab.com/the-common/bash-script-templates","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/the-common.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSES/CC-BY-SA-4.0.txt","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":"2022-04-27T18:41:52.000Z","updated_at":"2024-05-16T16:49:38.000Z","dependencies_parsed_at":"2024-05-16T18:03:34.957Z","dependency_job_id":null,"html_url":"https://github.com/the-common/bash-script-templates","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":"the-common/project-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-common%2Fbash-script-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-common%2Fbash-script-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-common%2Fbash-script-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-common%2Fbash-script-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/the-common","download_url":"https://codeload.github.com/the-common/bash-script-templates/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243141256,"owners_count":20242817,"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":["bash","scripting","templates"],"created_at":"2024-11-17T16:28:08.977Z","updated_at":"2025-12-24T21:27:34.944Z","avatar_url":"https://github.com/the-common.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The common GNU Bash shell script templates\n\nReady-to-use bash shell script templates at your fingertips!\n\n\u003chttps://gitlab.com/the-common/bash-script-templates\u003e  \n[![The GitLab CI pipeline status badge of the project's `main` branch](https://gitlab.com/the-common/bash-script-templates/badges/main/pipeline.svg?ignore_skipped=true \"Click here to check out the comprehensive status of the GitLab CI pipelines\")](https://gitlab.com/the-common/bash-script-templates/-/pipelines) [![GitHub Actions workflow status badge](https://github.com/the-common/bash-script-templates/actions/workflows/check-potential-problems.yml/badge.svg \"GitHub Actions workflow status\")](https://github.com/the-common/bash-script-templates/actions/workflows/check-potential-problems.yml) [![pre-commit enabled badge](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white \"This project uses pre-commit to check potential problems\")](https://pre-commit.com/) [![REUSE Specification compliance badge](https://api.reuse.software/badge/gitlab.com/the-common/bash-script-templates \"This project complies to the REUSE specification to decrease software licensing costs\")](https://api.reuse.software/info/gitlab.com/the-common/bash-script-templates)\n\n## Flavors\n\nThis product provides several _flavors_ of the Bash script template to satisfy different needs:\n\n### [BARE-MINIMUM](bare-minimum.sh)\n\nThe considered to be the bare-minimum for bash scripting:\n\n* Shebang/Hashbang file header\n* Script description and copyright declaration header\n* Defensive interpreter behavior settings\n\n### [BASIC](basic.sh)\n\nInherited from the [BARE-MINIMUM](#bare-minimum) flavor, but with the following additions:\n\n* Runtime dependency detection(check whether all the required commands are available from the command search PATHs\n* The following convenience variable definitions:\n    + `script`: The absolute path of the shell script\n    + `script_dir`: The absolute path of the directory that contains the shell script\n    + `script_filename`: The full filename of the shell script\n    + `script_name`: The name of the shellscript, excluding the filename suffixes\n    + `script_basecommand`: The base command(without arguments) when running the script\n    + `script_args`: An array containing all the command-line arguments when running the script\n\n## [MODULAR](modular.sh)\n\nInherited from the [BASIC](#basic) flavor, but with the following additions:\n\n* The introduction of the `init` function, which enables the moving of the program's main logic to the start of the script file, increases readability.\n* A new `trap_err` function has being implemented to handle the ERR trap so one can immediately recognize that an error has occurred when the `errexit` interpreter behavior is triggered.\n\n## References\n\n* [The Common / The common GNU Bash shell script templates · GitLab](https://gitlab.com/the-common/bash-script-templates)  \n  The project's main site\n* [Issues · The Common / The common GNU Bash shell script templates · GitLab](https://gitlab.com/the-common/bash-script-templates/-/issues)  \n  The project's issue tracker\n* [the-common/bash-script-templates: (MIRRORED FROM GITLAB) Ready-to-use bash shell script templates at your fingertips!](https://github.com/the-common/bash-script-templates)  \n  The GitHub Git repository mirror project\n* [GNU Bash manual - GNU Project - Free Software Foundation](https://www.gnu.org/software/bash/manual/)  \n  For references of the language and syntax used in the Bash scripts\n\n## Licensing\n\nUnless otherwise noted(individual file's header/[REUSE DEP5](.reuse/dep5)), this product is licensed under [the 4.0 International version of the Creative Commons Attribution-ShareAlike license](https://creativecommons.org/licenses/by-sa/4.0/), or any of its recent versions you would prefer, with an exception that the template is actually being used in a different kind of product(i.e. not a template), in that case feel free to use any license you prefer(an attribution to our project would be appreciated).\n\nThis work complies to the [REUSE Specification](https://reuse.software/spec/), refer [REUSE - Make licensing easy for everyone](https://reuse.software/) for info regarding the licensing of this product.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-common%2Fbash-script-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe-common%2Fbash-script-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-common%2Fbash-script-templates/lists"}