logo

utils-std

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

rmdir.t (1199B)


  1. #!/usr/bin/env cram
  2. # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. $ export PATH="$TESTDIR/../cmd:$PATH"
  5. $ test "$(command -v rmdir)" = "$TESTDIR/../cmd/rmdir"
  6. $ mkdir -p no_p/bar
  7. $ rmdir no_p/bar
  8. $ test -d no_p
  9. $ rm -r no_p
  10. $ mkdir -p p/bar
  11. $ rmdir -p p/bar
  12. $ test ! -e p
  13. $ mkdir -p v_no_p/bar
  14. $ rmdir -v v_no_p/bar
  15. rmdir: Removed 'v_no_p/bar'
  16. $ test -d v_no_p
  17. $ rm -r v_no_p
  18. $ mkdir -p v_p/bar
  19. $ rmdir -pv v_p/bar
  20. rmdir: Removed 'v_p/bar'
  21. rmdir: Removed 'v_p'
  22. $ test ! -e v_p
  23. $ touch file
  24. $ rmdir file
  25. rmdir: error: Failed removing 'file': Not a directory
  26. [1]
  27. $ rmdir -p file
  28. rmdir: error: Failed removing 'file': Not a directory
  29. [1]
  30. $ rmdir -v file
  31. rmdir: error: Failed removing 'file': Not a directory
  32. [1]
  33. $ rmdir -pv file
  34. rmdir: error: Failed removing 'file': Not a directory
  35. [1]
  36. $ rm file
  37. $ mkdir -p e_not_empty/a/b/c/d empty/a/b/c
  38. $ rmdir -p e_not_empty/a/b/c empty/a/b/c
  39. rmdir: error: Failed removing 'e_not_empty/a/b/c': Directory not empty
  40. [1]
  41. $ test -d e_not_empty/a/b/c
  42. $ test ! -e empty
  43. $ rm -r e_not_empty
  44. $ find .
  45. .