logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git

uname.sh (559B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. target="$(dirname "$0")/../cmd/uname"
  5. has_cmd ()
  6. {
  7. command -v "$@" >/dev/null
  8. }
  9. plans=5
  10. . "$(dirname "$0")/tap.sh"
  11. t 'no args' '' "$(uname -s)
  12. "
  13. t 's' '-s' "$(uname -s)
  14. "
  15. t 'a' '-a' "$(uname -s) $(uname -n) $(uname -r) $(uname -v) $(uname -m)
  16. "
  17. if has_cmd hostname; then
  18. t 'n' '-n' "$(hostname)
  19. "
  20. else
  21. skip n 'n' "no hostname command"
  22. fi
  23. if has_cmd arch; then
  24. t 'm' '-m' "$(arch)
  25. "
  26. else
  27. skip 'm' "no arch command"
  28. fi