Skip to content

Commit 1241492

Browse files
authored
Create shell_script_template.sh
1 parent 86dfebe commit 1241492

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

shell_script_template.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Shell Script Best Practices
2+
# from: https://sharats.me/posts/shell-script-best-practices/
3+
#!/usr/bin/env bash
4+
5+
set -o errexit
6+
set -o nounset
7+
set -o pipefail
8+
if [[ "${TRACE-0}" == "1" ]]; then
9+
set -o xtrace
10+
fi
11+
12+
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
13+
echo 'Usage: ./script.sh arg-one arg-two
14+
This is an awesome bash script to make your life better.
15+
'
16+
exit
17+
fi
18+
19+
cd "$(dirname "$0")"
20+
21+
main() {
22+
echo do awesome stuff
23+
}

0 commit comments

Comments
 (0)