mkdir.t (2409B)
- #!/usr/bin/env cram
- # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- $ export PATH="$TESTDIR/../cmd:$PATH"
- $ test "$(command -v mkdir)" = "$TESTDIR/../cmd/mkdir"
- # Using chmod -v + to get permission bits, + with no perm nor who doesn't changes mode bits
- $ test "$(command -v chmod)" = "$TESTDIR/../cmd/chmod"
- $ mkdir
- mkdir: Missing operand
- Usage: mkdir [-pv] [-m mode] path ...
- [1]
- $ umask 002
- $ test ! -e foo
- $ mkdir foo
- $ test -d foo
- $ rm -r foo
- $ test ! -e enoent
- $ mkdir enoent/file
- mkdir: Failed making directory 'enoent/file': No such file or directory
- [1]
- $ test ! -e enoent
- $ test ! -e gaia
- $ mkdir -p gaia/zeus
- $ chmod -v + gaia gaia/zeus
- chmod: Permissions already set to 00775/drwxrwxr-x for 'gaia'
- chmod: Permissions already set to 00775/drwxrwxr-x for 'gaia/zeus'
- $ rm -r gaia
- $ mkdir -v verbose1 verbose2
- mkdir: Made directory: verbose1
- mkdir: Made directory: verbose2
- $ chmod -v + verbose1 verbose2
- chmod: Permissions already set to 00775/drwxrwxr-x for 'verbose1'
- chmod: Permissions already set to 00775/drwxrwxr-x for 'verbose2'
- $ mkdir -v verbose_foo/verbose_bar
- mkdir: Failed making directory 'verbose_foo/verbose_bar': No such file or directory
- [1]
- $ test ! -e verbose_foo
- $ mkdir -vp verbose_foop/verbose_barp
- mkdir: Made directory: verbose_foop
- mkdir: Made directory: verbose_foop/verbose_barp
- $ chmod -v + verbose_foop verbose_foop/verbose_barp
- chmod: Permissions already set to 00775/drwxrwxr-x for 'verbose_foop'
- chmod: Permissions already set to 00775/drwxrwxr-x for 'verbose_foop/verbose_barp'
- $ rm -r verbose1 verbose2 verbose_foop
- $ mkdir -m +x plus_x
- $ chmod -v + plus_x
- chmod: Permissions already set to 00775/drwxrwxr-x for 'plus_x'
- $ rm -r plus_x
- $ mkdir -m go-x go_minus_x
- $ chmod -v + go_minus_x
- chmod: Permissions already set to 00764/drwxrw-r-- for 'go_minus_x'
- $ rm -r go_minus_x
- $ mkdir -m -x minus_x
- $ chmod -v + minus_x
- chmod: Permissions already set to 00664/drw-rw-r-- for 'minus_x'
- $ rm -r minus_x
- $ umask 024
- $ mkdir -p zero_two/four
- $ chmod -v + zero_two zero_two/four
- chmod: Permissions already set to 00753/drwxr-x-wx for 'zero_two'
- chmod: Permissions already set to 00753/drwxr-x-wx for 'zero_two/four'
- $ rm -r zero_two
- No files should be left
- $ find .
- .