I'm trying to determine if a substring (a file name) is present in a large string containing many file paths. This is my code which just doesn't work (prints "Does not contain"). I tried comparing with =~, different quotes usages. Nothing from that seems to work. Do you please see a problem in my code?
#!/bin/bash
text="/path/to/some/file1-2-3.json /another/path/to/file4-5-6.json"
my_file="file1-2-3.json"
if [[ *"$my_file"* == "$text" ]]; then
echo "Contain"
else
echo "Does not contain"
fi