logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: b04ba07147b2f0487de6136471e026e4d04496c3
parent 3a80ade19d893a1d8afa04c6394a74261e871c92
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 20 Sep 2024 12:13:12 +0200

test-cmd/head.sh: use tr instead of awk

Diffstat:

Mtest-cmd/head.sh15++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/test-cmd/head.sh b/test-cmd/head.sh @@ -40,15 +40,12 @@ t z3 "-n 3 -z ${WD}/test-cmd/inputs/strings/length" "$(printf '1\0_2\0__3\0')" set -o pipefail -head_40c() { </dev/zero "$target" -c 40 | wc -c | awk '{ print $1 }'; } -t_cmd 40c '40 -' head_40c +head_40c() { </dev/zero "$target" -c 40 | wc -c | tr -d '[:space:]'; } +t_cmd 40c '40' head_40c -head_40kc() { </dev/zero "$target" -c 40k | wc -c | awk '{ print $1 }'; } -t_cmd 40c '40960 -' head_40kc +head_40kc() { </dev/zero "$target" -c 40k | wc -c | tr -d '[:space:]'; } +t_cmd 40c '40960' head_40kc -head_40d() { </dev/zero "$target" -c 40d | wc -c | awk '{ print $1 }'; } +head_40d() { </dev/zero "$target" -c 40d | wc -c | tr -d '[:space:]'; } t_cmd --exit=1 40d "head: error: Unrecognised unit 'd' -0 -" head_40d +0" head_40d