Added a shorter solution for the directory diff exercise (#344)

Signed-off-by: Fabio Kruger <10956489+krufab@users.noreply.github.com>
This commit is contained in:
krufab 2023-02-02 12:00:23 +01:00 committed by GitHub
parent 47c39f6e9a
commit c664d2e7e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -14,7 +14,7 @@
|Sum|Functions|[Exercise](sum.md)|[Solution](solutions/sum.md) | Basic |Sum|Functions|[Exercise](sum.md)|[Solution](solutions/sum.md) | Basic
|Number of Arguments|Case Statement|[Exercise](num_of_args.md)|[Solution](solutions/num_of_args.md) | Basic |Number of Arguments|Case Statement|[Exercise](num_of_args.md)|[Solution](solutions/num_of_args.md) | Basic
|Empty Files|Misc|[Exercise](empty_files.md)|[Solution](solutions/empty_files.md) | Basic |Empty Files|Misc|[Exercise](empty_files.md)|[Solution](solutions/empty_files.md) | Basic
|Directories Comparison|Misc|[Exercise](directories_comparison.md)| :( | Basic |Directories Comparison|Misc|[Exercise](directories_comparison.md)|[Solution](solutions/directories_comparison.md) | Basic
|It's alive!|Misc|[Exercise](host_status.md)|[Solution](solutions/host_status.md) | Intermediate |It's alive!|Misc|[Exercise](host_status.md)|[Solution](solutions/host_status.md) | Intermediate
## Shell Scripting - Self Assessment ## Shell Scripting - Self Assessment

View File

@ -4,7 +4,7 @@
1. You are given two directories as arguments and the output should be any difference between the two directories 1. You are given two directories as arguments and the output should be any difference between the two directories
### Solution ### Solution 1
Suppose the name of the bash script is ```dirdiff.sh``` Suppose the name of the bash script is ```dirdiff.sh```
@ -26,5 +26,12 @@ then
fi fi
diff -q $1 $2 diff -q $1 $2
```
### Solution 2
With gnu find, you can use diff to compare directories recursively.
```shell
diff --recursive directory1 directory2
``` ```