File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -114,12 +114,13 @@ function script_exit() {
114114# caveat applies to both the $script_dir and $script_name variables.
115115# shellcheck disable=SC2034
116116function script_init() {
117- # Useful paths
117+ # Useful variables
118118 readonly orig_cwd=" $PWD "
119- readonly script_path=" ${BASH_SOURCE[1]} "
120- readonly script_dir=" $( dirname " $script_path " ) "
121- readonly script_name=" $( basename " $script_path " ) "
122119 readonly script_params=" $* "
120+ readonly script_path=" ${BASH_SOURCE[1]} "
121+ script_dir=" $( dirname " $script_path " ) "
122+ script_name=" $( basename " $script_path " ) "
123+ readonly script_dir script_name
123124
124125 # Important to always set as we use it in the exit handler
125126 # shellcheck disable=SC2155
@@ -218,7 +219,8 @@ function colour_init() {
218219function cron_init() {
219220 if [[ -n ${cron-} ]]; then
220221 # Redirect all output to a temporary file
221- readonly script_output=" $( mktemp --tmpdir " $script_name " .XXXXX) "
222+ script_output=" $( mktemp --tmpdir " $script_name " .XXXXX) "
223+ readonly script_output
222224 exec 3>&1 4>&2 1> " $script_output " 2>&1
223225 fi
224226}
Original file line number Diff line number Diff line change @@ -128,12 +128,13 @@ function script_exit() {
128128# caveat applies to both the $script_dir and $script_name variables.
129129# shellcheck disable=SC2034
130130function script_init() {
131- # Useful paths
131+ # Useful variables
132132 readonly orig_cwd=" $PWD "
133- readonly script_path=" ${BASH_SOURCE[0]} "
134- readonly script_dir=" $( dirname " $script_path " ) "
135- readonly script_name=" $( basename " $script_path " ) "
136133 readonly script_params=" $* "
134+ readonly script_path=" ${BASH_SOURCE[0]} "
135+ script_dir=" $( dirname " $script_path " ) "
136+ script_name=" $( basename " $script_path " ) "
137+ readonly script_dir script_name
137138
138139 # Important to always set as we use it in the exit handler
139140 # shellcheck disable=SC2155
@@ -232,7 +233,8 @@ function colour_init() {
232233function cron_init() {
233234 if [[ -n ${cron-} ]]; then
234235 # Redirect all output to a temporary file
235- readonly script_output=" $( mktemp --tmpdir " $script_name " .XXXXX) "
236+ script_output=" $( mktemp --tmpdir " $script_name " .XXXXX) "
237+ readonly script_output
236238 exec 3>&1 4>&2 1> " $script_output " 2>&1
237239 fi
238240}
You can’t perform that action at this time.
0 commit comments