ROOTPATH="/path/here"
p1 = "file1"
p2 = "file2"
for file in `find $ROOTPATH type f`; do
if [["$file" =~ $p1]]; then
echo 'got p1'
elif [["$file" =~ $p2]]; then
echo 'got p1'
else
echo 'got nothing'
This fails, and I'm not sure why. Both $p1
and $p2
are strings, and so is file.
Im trying to do a comparison on (2) strings, to see if $p1
or p2
exist in $file
on two separate conditions.
What am I doing wrong?