So I have the following:
cat file | grep -E regex
which gives a list of lines
Now I also have a for loop the produces a list of files
So it is like I have 2 arrays.
But how do I check in bash if both arrays have the same content? My bash version does not support associative arrays (4.2).
Should I find another way other than bash or is it doable with bash easily too?
Update
I go over for i in foo/bar/*
and record the paths so I essentially I have somewhere:
foo/bar/a/b
foo/bar/c/d
foo/bar/e etc
So I essentially just want to re-run the for loop and check that I get exactly the same outcome.
grep
ordiff
could help. Add sample data to your post for more infos.file
? Or can you declare an assumption/restriction that your filenames will never have newlines in them?