I'm working on the bash script that iterates over the list of files. I need to compare the paths to this files with the array containing the restricted paths.
Inside the for loop I get a path to a file like this:
dname="$(dirname "$i")";
This returns me a relative path like path/to/file
The list of restricted paths is stored in the array:
restricted=(
path/to/file
another/path/to/file
);
Then I'm trying to compare the paths:
if [[ "${restricted[*]}" = "$dname" ]]; then
//do some things
fi
However the comparison does not seem to work.
Could you please advise how to solve the issue?
Thank you.