logo

utils-std

Collection of commonly available Unix tools
commit: 3dae27055e40bf23515f10a9d1ca5630e7eef03c
parent 6a627a23f5c605b4b77ae17da2c42571be771bc6
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu,  1 Aug 2024 02:45:20 +0200

test-cmd/uname.sh: Skip -n test when hostname(1) is absent

Diffstat:

Mtest-cmd/uname.sh14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/test-cmd/uname.sh b/test-cmd/uname.sh @@ -19,7 +19,15 @@ t 's' '-s' "$(uname -s) " t 'a' '-a' "$(uname -s) $(uname -n) $(uname -r) $(uname -v) $(uname -m) " -t 'n' '-n' "$(hostname) +if has_cmd hostname; then + t 'n' '-n' "$(hostname) " -if has_cmd arch; then t 'm' '-m' "$(arch) -"; else skip '-m' "no arch command"; fi +else + skip n 'n' "no hostname command" +fi +if has_cmd arch; then + t 'm' '-m' "$(arch) +" +else + skip 'm' "no arch command" +fi