logo

utils-std

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

mkdir.t (2409B)


  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 mkdir)" = "$TESTDIR/../cmd/mkdir"
  6. # Using chmod -v + to get permission bits, + with no perm nor who doesn't changes mode bits
  7. $ test "$(command -v chmod)" = "$TESTDIR/../cmd/chmod"
  8. $ mkdir
  9. mkdir: Missing operand
  10. Usage: mkdir [-pv] [-m mode] path ...
  11. [1]
  12. $ umask 002
  13. $ test ! -e foo
  14. $ mkdir foo
  15. $ test -d foo
  16. $ rm -r foo
  17. $ test ! -e enoent
  18. $ mkdir enoent/file
  19. mkdir: Failed making directory 'enoent/file': No such file or directory
  20. [1]
  21. $ test ! -e enoent
  22. $ test ! -e gaia
  23. $ mkdir -p gaia/zeus
  24. $ chmod -v + gaia gaia/zeus
  25. chmod: Permissions already set to 00775/drwxrwxr-x for 'gaia'
  26. chmod: Permissions already set to 00775/drwxrwxr-x for 'gaia/zeus'
  27. $ rm -r gaia
  28. $ mkdir -v verbose1 verbose2
  29. mkdir: Made directory: verbose1
  30. mkdir: Made directory: verbose2
  31. $ chmod -v + verbose1 verbose2
  32. chmod: Permissions already set to 00775/drwxrwxr-x for 'verbose1'
  33. chmod: Permissions already set to 00775/drwxrwxr-x for 'verbose2'
  34. $ mkdir -v verbose_foo/verbose_bar
  35. mkdir: Failed making directory 'verbose_foo/verbose_bar': No such file or directory
  36. [1]
  37. $ test ! -e verbose_foo
  38. $ mkdir -vp verbose_foop/verbose_barp
  39. mkdir: Made directory: verbose_foop
  40. mkdir: Made directory: verbose_foop/verbose_barp
  41. $ chmod -v + verbose_foop verbose_foop/verbose_barp
  42. chmod: Permissions already set to 00775/drwxrwxr-x for 'verbose_foop'
  43. chmod: Permissions already set to 00775/drwxrwxr-x for 'verbose_foop/verbose_barp'
  44. $ rm -r verbose1 verbose2 verbose_foop
  45. $ mkdir -m +x plus_x
  46. $ chmod -v + plus_x
  47. chmod: Permissions already set to 00775/drwxrwxr-x for 'plus_x'
  48. $ rm -r plus_x
  49. $ mkdir -m go-x go_minus_x
  50. $ chmod -v + go_minus_x
  51. chmod: Permissions already set to 00764/drwxrw-r-- for 'go_minus_x'
  52. $ rm -r go_minus_x
  53. $ mkdir -m -x minus_x
  54. $ chmod -v + minus_x
  55. chmod: Permissions already set to 00664/drw-rw-r-- for 'minus_x'
  56. $ rm -r minus_x
  57. $ umask 024
  58. $ mkdir -p zero_two/four
  59. $ chmod -v + zero_two zero_two/four
  60. chmod: Permissions already set to 00753/drwxr-x-wx for 'zero_two'
  61. chmod: Permissions already set to 00753/drwxr-x-wx for 'zero_two/four'
  62. $ rm -r zero_two
  63. No files should be left
  64. $ find .
  65. .