-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path初始化開發環境.bash
executable file
·44 lines (34 loc) · 2.18 KB
/
初始化開發環境.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
# 上列為宣告執行 script 程式用的殼程式(shell)的 shebang
# 初始化開發環境 - 初始化開發環境的程式,參與開發前請先執行它
# 林博仁 <[email protected]> © 2016
######## File scope variable definitions ########
# Defensive Bash Programming - not-overridable primitive definitions
# http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/
declare -r PROGRAM_FILENAME="$(basename "$0")"
declare -r PROGRAM_DIRECTORY="$(realpath --no-symlinks "$(dirname "$0")")"
declare -r PROGRAM_ARGUMENT_ORIGINAL_LIST="$@"
declare -r PROGRAM_ARGUMENT_ORIGINAL_NUMBER=$#
## Unofficial Bash Script Mode
## http://redsymbol.net/articles/unofficial-bash-strict-mode/
# 將未定義的變數的參考視為錯誤
set -u
# Exit immediately if a pipeline, which may consist of a single simple command, a list, or a compound command returns a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a `while' or `until' keyword, part of the test in an `if' statement, part of any command executed in a `&&' or `||' list except the command following the final `&&' or `||', any command in a pipeline but the last, or if the command's return status is being inverted with `!'. If a compound command other than a subshell returns a non-zero status because a command failed while `-e' was being ignored, the shell does not exit. A trap on `ERR', if set, is executed before the shell exits.
set -e
# If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully.
set -o pipefail
declare -r PROJECT_DIRECTORY="${PROGRAM_DIRECTORY}"
######## File scope variable definitions ended ########
######## Included files ########
######## Included files ended ########
######## Program ########
# Defensive Bash Programming - main function, program entry point
# http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/
main() {
git config include.path ../.gitconfig
printf "專案專屬 Git 設定設定完成。\n"
## 正常結束 script 程式
exit 0
}
main
######## Program ended ########