mirror of https://github.com/01-edu/public.git
11 changed files with 68 additions and 0 deletions
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
# Unofficial Bash Strict Mode |
||||
set -euo pipefail |
||||
IFS=' |
||||
' |
||||
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) |
||||
|
||||
challenge() { |
||||
submitted=$(ls -l "$1" && bash "$script_dirS"/student/hard-perm.sh) |
||||
expected=$(ls -l "$1" && bash "$script_dirS"/solutions/hard-perm.sh) |
||||
|
||||
diff <(echo "$submitted") <(echo "$expected") |
||||
} |
||||
|
||||
challenge hard-perm/ |
@ -0,0 +1 @@
|
||||
chmod 401 hard-perm/0 hard-perm/A && chmod 402 hard-perm/1 hard-perm/9 && chmod 604 hard-perm/2 hard-perm/8 && chmod 777 hard-perm/3 && chmod 510 hard-perm/4 hard-perm/7 && chmod 460 hard-perm/5 hard-perm/6 |
@ -0,0 +1,51 @@
|
||||
## hard-perm |
||||
|
||||
### Instructions |
||||
|
||||
Create a file `hard-perm.sh`, which will change the default permissions for the files and folders inside the folder `hard-perms`, to the ones bellow: |
||||
|
||||
Right now the folder looks like this: |
||||
|
||||
```console |
||||
$ ls -l hard-perm |
||||
total 12 |
||||
drwxrwxr-x 2 user user 4096 dez 13 18:10 0 |
||||
-rw-rw-r-- 1 user user 0 dez 13 18:11 1 |
||||
-rw-rw-r-- 1 user user 0 dez 13 18:11 2 |
||||
drwxrwxr-x 2 user user 4096 dez 13 18:10 3 |
||||
-rw-rw-r-- 1 user user 0 dez 13 18:11 4 |
||||
-rw-rw-r-- 1 user user 0 dez 13 18:11 5 |
||||
-rw-rw-r-- 1 user user 0 dez 13 18:11 6 |
||||
-rw-rw-r-- 1 user user 0 dez 13 18:11 7 |
||||
-rw-rw-r-- 1 user user 0 dez 13 18:11 8 |
||||
-rw-rw-r-- 1 user user 0 dez 13 18:11 9 |
||||
drwxrwxr-x 2 user user 4096 dez 13 18:10 A |
||||
|
||||
``` |
||||
|
||||
Expected output: |
||||
|
||||
```console |
||||
$ ls -l hard-perm |
||||
total 12 |
||||
dr-------x 2 user user 4096 dez 13 17:50 0 |
||||
-r------w- 1 user user 0 dez 13 17:51 1 |
||||
-rw----r-- 1 user user 0 dez 13 17:51 2 |
||||
drwxrwxrwx 2 user user 4096 dez 13 17:51 3 |
||||
-r-x--x--- 1 user user 0 dez 13 17:51 4 |
||||
-r--rw---- 1 user user 0 dez 13 17:51 5 |
||||
-r--rw---- 1 user user 0 dez 13 17:51 6 |
||||
-r-x--x--- 1 user user 0 dez 13 17:51 7 |
||||
-rw----r-- 1 user user 0 dez 13 17:51 8 |
||||
-r------w- 1 user user 0 dez 13 17:51 9 |
||||
dr-------x 2 user user 4096 dez 13 17:50 A |
||||
``` |
||||
|
||||
### Hints |
||||
|
||||
> You have to use Man or Google to know more about commands flags, in order to solve this exercise! |
||||
> Google and Man will be your friends! |
||||
|
||||
### References |
||||
|
||||
- [Chmod](https://www.linode.com/docs/guides/modify-file-permissions-with-chmod/#modify-file-permissions-with-chmod) |
Loading…
Reference in new issue