commit: 238ef549ea87eb21e701eeff6da6640f6562ac91
parent 68e67c3936ae23ddb8d05ba168e04ad68ad59f65
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 23 Aug 2024 05:31:20 +0200
test-cmd/split.sh: use set instead of cut to extract from wc(1)
A perhaps more idiomatic one would have been to use awk,
but awk is only available much later in the bootstrapping process.
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test-cmd/split.sh b/test-cmd/split.sh
@@ -42,8 +42,8 @@ check_splits_b32()
{
for i in split_test_b32_*
do
- size="$(wc -c $i | cut -d' ' -f1)"
- if [ "$size" != "32" ]
+ set -- $(wc -c "$i")
+ if [ "$1" != "32" ]
then
printf "# Expected 32 bytes but '%s' is %s bytes\n" "$i" "$size"
return 1
@@ -55,8 +55,8 @@ check_splits_l10()
{
for i in split_test_l10_*
do
- size="$(wc -l $i | cut -d' ' -f1)"
- if [ "$size" != "10" ]
+ set -- $(wc -l "$i")
+ if [ "$1" != "10" ]
then
printf "# Expected 10 lines but '%s' has %s lines\n" "$i" "$size"
return 1