A simple starting place for new Bash scripts. This script:
- Uses
/usr/bin/env bash
for portability. - Uses the unofficial Bash Strict Mode.
- Checks that bash 4 is executing the script.
The easiest way to get started is by clicking the green Use this template button, then selecting Create a new repository. You will then be guided through creating a new repository in your account that uses the files in this repository as a template!
Open the user snippets file called "shellscript.json" and add the following:
"Bash Strict Mode Starter": {
"prefix": "starter",
"body": ["#!/usr/bin/env bash","#","# Short description goes here. Maximum 3 sentences. If possible, keep each line","# under 80 characters for easy readability.","","","init() {"," set -euo pipefail # strict mode"," #set -x # uncomment when debugging your script"," IFS=$'\\n\\t' # IFS restricted to newline and tab","}","","","main() {"," init # run init function"," echo success","}","","","# make sure bash 4 is being used and run the script, exit otherwise","# this prevents people from running the script with an unsupported interpreter","if [ -z \"${BASH_VERSINFO}\" ] || [ -z \"${BASH_VERSINFO[0]}\" ] || [ ${BASH_VERSINFO[0]} -lt 4 ]","then"," echo \"This script requires Bash version 4 or newer.\""," exit 1","else"," main","fi"],
"description": "A starter script for a Bash shell script."
}
The issues tracker contains both issues and feature requests. There are templates available if you're not sure how to submit your issue.
Occasionally, I will mark simple issues with the good first issue label so
that newcomers to git
can learn the ropes. If you're new, please check these
out to get your hands dirty!
If you have absolutely no experience to the git
workflow, or you need a
refresher, check out this site made
by rogerdudler!
- Fork this repository
- Add your change
- Create a pull request
Note: I am testing GitKraken's GitFlow feature with this repository. You are NOT required to follow this style of contribution.