Skip to content

Commit 2f3bda5

Browse files
committed
Use a for loop instead of a while loop
1 parent 0aaba10 commit 2f3bda5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

share/github-backup-utils/ghe-backup-es-audit-log

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ if echo 'set -o pipefail; ! test -e /data/user/common/es-scan-complete && test -
4141
fi
4242
fi
4343

44-
while read index; do
44+
IFS=$'\n'
45+
for index in $indices; do
46+
IFS=' '
4547
set $index
4648
index_name=$1
4749
index_size=$2
@@ -54,6 +56,6 @@ while read index; do
5456
ghe-ssh "$host" "/usr/local/share/enterprise/ghe-es-dump-json \"http://localhost:$es_port/$index_name\"" | gzip > $GHE_SNAPSHOT_DIR/audit-log/$index_name.gz
5557
echo $index_size > $GHE_SNAPSHOT_DIR/audit-log/$index_name.gz.size
5658
fi
57-
done <<< "$indices"
59+
done
5860

5961
bm_end "$(basename $0)"

share/github-backup-utils/ghe-backup-es-hookshot

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ fi
3434
# Hookshot indices may not exist if no recent webhook deliveries have occured.
3535
[ -z "$indices" ] && exit
3636

37-
while read index; do
37+
IFS=$'\n'
38+
for index in $indices; do
39+
IFS=' '
3840
set $index
3941
index_name=$1
4042
index_size=$2
@@ -47,6 +49,6 @@ while read index; do
4749
ghe-ssh "$host" "/usr/local/share/enterprise/ghe-es-dump-json \"http://localhost:$es_port/$index_name\"" | gzip > $GHE_SNAPSHOT_DIR/hookshot/$index_name.gz
4850
echo $index_size > $GHE_SNAPSHOT_DIR/hookshot/$index_name.gz.size
4951
fi
50-
done <<< "$indices"
52+
done
5153

5254
bm_end "$(basename $0)"

0 commit comments

Comments
 (0)