https://github.com/fluential/bash-script-template
A bash script template / boilerplate to start your script with
https://github.com/fluential/bash-script-template
Last synced: about 1 month ago
JSON representation
A bash script template / boilerplate to start your script with
- Host: GitHub
- URL: https://github.com/fluential/bash-script-template
- Owner: fluential
- Created: 2015-03-24T11:18:46.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-04-07T16:10:07.000Z (about 5 years ago)
- Last Synced: 2025-03-17T15:57:46.535Z (over 1 year ago)
- Language: Shell
- Size: 4.88 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](http://hits.dwyl.com/fluential/bash-script-template)
# bash-script-template
A bash script template / boilerplate to start your script with.
It should cover all basic needs to create robust bash scripts - this is mostly around error handling + links to some guide documents, it will:
- Gracefully cleanup() after itself by trapping SIGHUP SIGINT SIGQUIT SIGTERM signals - very usefull when you work on some resources and you want to release them even when the script is interrupted
- Set shopt -s nullglob dotglob for better handling bash file expansions - becasue you should NOT parse ls output
- Set -o pipefail to surface any failed commands torugh the pipe-line
There is no main function which the primary purpose is to make script sourceable by other scripts for function re-use.
Bash requires extra work to surface errors when you source scripts and if you really need more than this template you should consider a different language.
Feel free to contribute.