@@ -9,7 +9,7 @@ scmpuff_status() {
9
9
# Run scmpuff status, store output
10
10
# (`local` needs to be on its own line otherwise exit code is swallowed!)
11
11
local cmd_output
12
- cmd_output=" $( /usr/bin/env scmpuff status --filelist $@ ) "
12
+ cmd_output=$( /usr/bin/env scmpuff status --filelist " $@ " )
13
13
14
14
# if there was an error, exit prematurely, and pass along the exit code
15
15
# (STDOUT was swallowed but not STDERR, so user should still see error msg)
@@ -19,17 +19,19 @@ scmpuff_status() {
19
19
fi
20
20
21
21
# Fetch list of files (from first line of script output)
22
+ local files
22
23
files=" $( echo " $cmd_output " | head -n 1) "
23
24
24
25
# Export numbered env variables for each file
25
26
scmpuff_clear_vars
26
- IFS=$' \t '
27
+ IFS=$( printf ' \t' )
27
28
local e=1
29
+ local file
28
30
for file in $files ; do
29
31
export $scmpuff_env_char$e =" $file "
30
- let e++
32
+ e= $(( e + 1 ))
31
33
done
32
- IFS=$' \t\n '
34
+ IFS=$( printf ' \t\n' )
33
35
34
36
# Print status (from line two onward)
35
37
echo " $cmd_output " | tail -n +2
@@ -42,14 +44,14 @@ scmpuff_status() {
42
44
# Clear numbered env variables
43
45
scmpuff_clear_vars () {
44
46
local scmpuff_env_char=" e"
45
- local i
46
-
47
- for (( i= 1 ; i<= 999 ; i++ )) ; do
48
- local env_var_i=${scmpuff_env_char}${i}
49
- if [[ -n ${env_var_i} ]]; then
47
+ local i=0
48
+ while [ $i -le 999 ]; do
49
+ env_var_i=${scmpuff_env_char}${i}
50
+ if [ -n " $env_var_i " ]; then
50
51
unset ${env_var_i}
51
52
else
52
53
break
53
54
fi
55
+ i=$(( i+ 1 ))
54
56
done
55
57
}
0 commit comments