{"id":21306304,"url":"https://github.com/brlin-tw/gnu-bash-shell-script-template","last_synced_at":"2025-07-16T16:33:29.177Z","repository":{"id":143329524,"uuid":"89415894","full_name":"brlin-tw/GNU-Bash-Shell-Script-Template","owner":"brlin-tw","description":"Easy-to-use GNU Bash shell script templates for  for users to create new scripts.","archived":false,"fork":false,"pushed_at":"2024-12-14T17:52:54.000Z","size":240,"stargazers_count":17,"open_issues_count":7,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T09:23:20.664Z","etag":null,"topics":["bash","shell-script","template"],"latest_commit_sha":null,"homepage":"https://github.com/Lin-Buo-Ren/GNU-Bash-Shell-Script-Template","language":"Shell","has_issues":true,"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/brlin-tw.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":"CONTRIBUTING.markdown","funding":null,"license":null,"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":"2017-04-25T23:27:23.000Z","updated_at":"2024-12-14T17:52:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"f339207e-a1f0-4041-8288-60bea13e3992","html_url":"https://github.com/brlin-tw/GNU-Bash-Shell-Script-Template","commit_stats":null,"previous_names":[],"tags_count":83,"template":false,"template_full_name":null,"purl":"pkg:github/brlin-tw/GNU-Bash-Shell-Script-Template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brlin-tw%2FGNU-Bash-Shell-Script-Template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brlin-tw%2FGNU-Bash-Shell-Script-Template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brlin-tw%2FGNU-Bash-Shell-Script-Template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brlin-tw%2FGNU-Bash-Shell-Script-Template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brlin-tw","download_url":"https://codeload.github.com/brlin-tw/GNU-Bash-Shell-Script-Template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brlin-tw%2FGNU-Bash-Shell-Script-Template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264902357,"owners_count":23681050,"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","shell-script","template"],"created_at":"2024-11-21T16:23:06.025Z","updated_at":"2025-07-11T21:31:27.245Z","avatar_url":"https://github.com/brlin-tw.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GNU Bash Shell Script Template\n[![This project's current build status on Travis CI](https://travis-ci.org/Lin-Buo-Ren/GNU-Bash-Shell-Script-Template.svg?branch=master)](https://travis-ci.org/Lin-Buo-Ren/GNU-Bash-Shell-Script-Template)  \nThis project provides easy-to-use shell script templates for GNU Bash for users to create new scripts.  \n\u003chttps://github.com/Lin-Buo-Ren/GNU-Bash-Shell-Script-Template\u003e\n\n![Template Selection Menu in Dolphin FM(KDE)](Pictures/Template%20Selection%20Menu%20in%20Dolphin%20FM%28KDE%29.png)\n\n## Features\n### Debugger-friendly\n\nLocal debuggers need fresh livers, we made scripts more error-proof and bug-aware by bailing out whenever a potential scripting error is found.\n\nSecure programming paradigms like [Unofficial Bash Strict Mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/) and [Defensive BASH Programming](https://frippertronics.com/posts/defensive_bash_programming.html) are incorporated into the template design.\n\n### Developer-friendly\n\nWe want developers to fucus on their code instead of the template's, so we moved developer related code like the `init`function, `print_help_message` function and `process_commandline_arguments` function to the start of the script and rest of the support code at the bottom.\n\nThe template is fully versioned at the bottom of the script, which is useful to upgrade your script to new template versions for new features and fixes.\n\n### Beginner-friendly\n\nThe code is documented with essential pointers for beginner to lookup with, like relevant [GNU Bash manual](https://www.gnu.org/software/bash/manual/) sections, [Stack Overflow](https://stackoverflow.com/) answers and [Bash Hackers Wiki](http://wiki.bash-hackers.org) articles.\n\n### Full of Functionalities\n\nWe have incorporated the following features into the templates, so that user don't need to recreate wheels.\n\n* Integrated runtime dependency checking\n* ERR/EXIT/INT traps for exception handling\n* Command-line argument parsing with GNU long variant option support\n* `--help` message printing\n* Frequently used primitive variables\n  * RUNTIME_EXECUTABLE_PATH  \n    `/home/username/somewhere/My Awesome Script.bash`\n  * RUNTIME_EXECUTABLE_FILENAME  \n    `My Awesome Script.bash`\n  * RUNTIME_EXECUTABLE_NAME  \n    `My Awesome Script`\n  * RUNTIME_EXECUTABLE_DIRECTORY  \n    `/home/username/somewhere`\n  * RUNTIME_COMMANDLINE_BASECOMMAND  \n    A guessed command string that user used to run the script\n    * `My Awesome Script.bash` if the script is in the executable search `PATH`s (only in full variant)\n    * `${0}`otherwises.\n  * RUNTIME_COMMANDLINE_PARAMETERS  \n    An array of command-line parameters\n\n![Demonstration - Runtime Dependency Checking.png](Pictures/Demonstration%20-%20Runtime%20Dependency%20Checking.png)\n\n![Demonstration - Command-line Argument Parsing and Help Message](Pictures/Demonstration%20-%20Command-line%20Argument%20Parsing%20and%20Help%20Message.png)\n\n![Demonstration - EXIT Trap and Terminal Pausing](Pictures/Demonstration%20-%20EXIT%20Trap%20and%20Terminal%20Pausing.png)\n\n### Space and non-ASCII Characters Friendly\n\nScript won't broke in an exotic environment.\n\n![Unsafe Path Friendly](Pictures/Unsafe%20Path%20Friendly.png)\n\n### With Installer that can Install Templates to XDG-compliant File Manager Applications\n\nSupports:\n\n* Dolphin\n* GNOME Files\n* Thunar\n* and more...(as long as they are compliant)\n\n### Need More or Less?  You're Covered\n\nThe following variants are provided:\n\n* **PRIMITIVE**  \n  The recommended variant for regular use, core functionalities included.\n* **MILIMALISTIC**  \n  If you want it more simpler and don't mind recreating a few more wheels.\n* **FULL**  \n  Hundreds of lines of support code, including additional features like:\n  * Stacktrace printing\n  * Multiple installation configuration support: Standalone/SHC/FHS, conforming to the [Flexible Software Installation Specification](https://github.com/Lin-Buo-Ren/Flexible-Software-Installation-Specification)\n  * Utility functions like `meta_util_array_shift`\n  * ...and more\n* **SOURCE'D**  \n  Template for source'd code, with include guard support\n* **VANILLA.BASH**  \n  [Vanilla.bash* is a fast, lightweight, backward compatible template for building incredible, powerful GNU Bash applications.](https://github.com/Lin-Buo-Ren/Vanilla.bash)\n\n### Verified, as Always\n\nThe code is continuously verified by [ShellCheck](https://www.shellcheck.net/) to not containing any potential pitfalls.\n\n## Conforming Specifications\n* Use the Unofficial Bash Strict Mode (Unless You Looove Debugging)  \n  \u003chttp://redsymbol.net/articles/unofficial-bash-strict-mode/\u003e\n* Defensive BASH programming - Say what?  \n  \u003chttp://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/\u003e\n* Shebang (Unix) - Wikipedia  \n  \u003chttps://en.wikipedia.org/wiki/Shebang_(Unix)\u003e\n* Flexible Software Installation Specification  \n  \u003chttps://github.com/Lin-Buo-Ren/Flexible-Software-Installation-Specification\u003e\n\n## References\nSome information used to improve the project:\n\n* [BashFAQ/How do I determine the location of my script? I want to read some config files from the same place. - Greg's Wiki](http://mywiki.wooledge.org/BashFAQ/028)\n\n## Software Dependencies\n### Runtime Dependencies\nSoftware required to run the product:\n\n#### [GNU Core Utilities(Coreutils)](http://www.gnu.org/software/coreutils/coreutils.html)\nFor fetching script names and paths\n\n### Development Dependencies\nSoftware required to develop the product:\n\n#### [GNU Sed](https://www.gnu.org/software/sed/)\nFor implementing script version injection\n\n#### [Git](https://git-scm.com/)\nFor revision management etc.\n\n#### [pre-commit - A framework for managing and maintaining multi-language pre-commit hooks](https://pre-commit.com/)\nFor various pre-commit hooks checking many aspects in the project and commit verification during continuous integration.\n\n#### [ShellCheck – shell script analysis tool](http://www.shellcheck.net/)\nTo check any potential problems in the script\n\n## Download Software\nPlease refer the [releases page](https://github.com/Lin-Buo-Ren/GNU-Bash-Shell-Script-Template/releases) for ready to use software.\n\n## Intellectual Property License\nGNU General Public License v3+ *with an exception of only using this software as a template of a shell script(which you can use any license you prefer, attribution appreciated)*\n\nThis means that GPL is enforced only when you're making another \"shell script template\" using this software, which you're demanded to also using GPL for your work\n\n## Similar Projects\nSimilar projects that we may benefit from:\n\n* [BASH3 Boilerplate – Template for writing better Bash scripts](http://bash3boilerplate.sh/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrlin-tw%2Fgnu-bash-shell-script-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrlin-tw%2Fgnu-bash-shell-script-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrlin-tw%2Fgnu-bash-shell-script-template/lists"}