Skip to content

Conversation

@Prajwalmithun
Copy link
Contributor

Hi @bregman-arie,
I have added the solution for this issue #240
Please check and accept my PR

Thanks,
Prajwal

@Prajwalmithun
Copy link
Contributor Author

I was checking the other PRs for this question. I guess you asked for a solution that displays a message if both the directories are the same. I have added those features as well in the below script. Please check

#!/bin/bash

if test $# -ne 2
then
	echo -e "USAGE: ./dirdiff.sh directory1 directory2"
	exit 1
fi

# check for the checksums. 
# If both the checksums same, then both directories are same
if test `ls -1 $1 | sort | md5sum | awk -F "  " '{print $1}'` == `ls -1 $2 | sort | md5sum | awk -F "  " '{print $1}'`
then
	echo -e "No difference between the 2 directories"
	exit 0
fi

diff -q $1 $2

@bregman-arie
Copy link
Owner

Looks good. Thank you

@bregman-arie bregman-arie merged commit 9a59213 into bregman-arie:master Jun 1, 2022
eshack94 pushed a commit to eshack94/devops-exercises that referenced this pull request Oct 21, 2023
* added solution to directories_comparision.md

* updated the previous shell code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants