@@ -77,7 +77,7 @@ parse_args() {
77
77
}
78
78
79
79
ensure_file () {
80
- if [ ! -f $CONFIG_FILE ]; then
80
+ if [ ! -f " $CONFIG_FILE " ]; then
81
81
error " No $CONFIG_FILE file found!"
82
82
fi
83
83
}
@@ -134,10 +134,10 @@ read_file() {
134
134
local line_trimmed=$( echo " $line " | sed -e ' s/^ *//' )
135
135
local len_trimmed=$( expr " $line_trimmed " : ' .*' )
136
136
local len_full=$( expr " $line " : ' .*' )
137
- local group_indent=$(( $ len_full - $ len_trimmed))
137
+ local group_indent=$(( len_full - len_trimmed))
138
138
fi
139
139
140
- local line_trimmed=${line: $(( $ group_indent)) }
140
+ local line_trimmed=${line: $group_indent }
141
141
142
142
# Detect element-end
143
143
local first_chars=${line_trimmed: 0: 2}
@@ -172,7 +172,7 @@ read_file() {
172
172
# Handle lines
173
173
current_line=" ${current_line}${next_spacer}${line_content} "
174
174
next_spacer=" ${default_spacer} "
175
- done < <( cat $CONFIG_FILE )
175
+ done < <( cat " $CONFIG_FILE " )
176
176
177
177
current_line=" ${current_line: 2} "
178
178
echo " ${current_line} "
@@ -184,14 +184,14 @@ process_commands() {
184
184
local tempfile=$( mktemp -t circleci_matrix.XXX)
185
185
186
186
while read -r line; do
187
- cp -f $envfile $tempfile
188
- echo -e " $line " >> $tempfile
187
+ cp -f " $envfile " " $tempfile "
188
+ echo -e " $line " >> " $tempfile "
189
189
190
190
set +e
191
- (bash $tempfile )
191
+ (bash " $tempfile " )
192
192
local exitcode=$?
193
193
set -e
194
- rm -rf $tempfile
194
+ rm -rf " $tempfile "
195
195
196
196
if [ $exitcode -ne 0 ]; then
197
197
(( FAILED_COMMANDS= FAILED_COMMANDS+ 1 ))
@@ -209,17 +209,19 @@ process_envs() {
209
209
local sources_prefix=" $( sources) "
210
210
211
211
while read -r line; do
212
- if [ $(( $ i % $ CIRCLE_NODE_TOTAL)) -eq $CIRCLE_NODE_INDEX ]; then
212
+ if [ $(( i % CIRCLE_NODE_TOTAL)) -eq " $CIRCLE_NODE_INDEX " ]; then
213
213
print_horizontal_rule
214
214
info " Env: $line "
215
215
print_horizontal_rule
216
216
217
- rm -rf $tempfile
218
- echo " #!/usr/bin/env bash" >> $tempfile
219
- echo " $sources_prefix " >> $tempfile
220
- echo -e " $line " >> $tempfile
221
- process_commands $tempfile
222
- rm -rf $tempfile
217
+ rm -rf " $tempfile "
218
+ {
219
+ echo " #!/usr/bin/env bash" ;
220
+ echo " $sources_prefix " ;
221
+ echo -e " $line "
222
+ } >> " $tempfile "
223
+ process_commands " $tempfile "
224
+ rm -rf " $tempfile "
223
225
224
226
info " "
225
227
fi
@@ -228,7 +230,7 @@ process_envs() {
228
230
}
229
231
230
232
main () {
231
- parse_args $@
233
+ parse_args " $@ "
232
234
233
235
info " circleci-matrix version: $VERSION "
234
236
info " circleci node total: $CIRCLE_NODE_TOTAL "
@@ -249,4 +251,4 @@ trim_right() {
249
251
echo -n " $var "
250
252
}
251
253
252
- main $@
254
+ main " $@ "
0 commit comments