logo

utils-std

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

id.sh (701B)


  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/id"
  5. plans=11
  6. . "$(dirname "$0")/tap.sh"
  7. usage='Usage: id [-Ggu] [-nr] [user]
  8. '
  9. t g -g "$(id -g)
  10. "
  11. t gr -gr "$(id -gr)
  12. "
  13. t gn -gn "$(id -gn)
  14. "
  15. t gnr -gnr "$(id -gnr)
  16. "
  17. t u -u "$(id -u)
  18. "
  19. t ur -ur "$(id -ur)
  20. "
  21. t un -un "$(id -un)
  22. "
  23. t unr -unr "$(id -unr)
  24. "
  25. # Make sure the correct list is returned for different users
  26. # Previously it would only return the runtime list of the current user
  27. t G_nobody '-G nobody' "$(id -G nobody)
  28. "
  29. t G_root '-G root' "$(id -G root)
  30. "
  31. t --exit=1 badarg '-a' "id: error: Unhandled option '-a'
  32. ${usage}"