1 |
On 11/23/2014 01:09 AM, Micha³ Górny wrote: |
2 |
>>> + # Collect file names of QA checks. We need them early to support |
3 |
>>> + # overrides properly. |
4 |
>>> + for d in "${paths[@]}"; do |
5 |
>>> + for f in "${d}"/*; do |
6 |
>>> + [[ -f ${f} ]] && qa_checks+=( "${f##*/}" ) |
7 |
>>> done |
8 |
>>> done |
9 |
>>> |
10 |
>>> + # Now we need to sort the filenames lexically, and process |
11 |
>>> + # them in order. |
12 |
>>> + while IFS= read -r -d '' f; do |
13 |
>> |
14 |
>> I'm not sure how IFS is relevant here. Please clarify. |
15 |
> |
16 |
> Unsetting IFS prevents word splitting. Otherwise just the first word |
17 |
> would get assigned to f and others discarded. |
18 |
|
19 |
Can you create a test case to demonstrate why it's needed? I created |
20 |
this test case that seems to work fine without changing IFS: |
21 |
|
22 |
qa_checks=("d e f" "a b c") |
23 |
|
24 |
while read -r -d '' f; do |
25 |
echo "$f" |
26 |
done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z) |
27 |
|
28 |
-- |
29 |
Thanks, |
30 |
Zac |