I have the following in bash:
string="/opt/directory/"
Then when I do the following:
if [[ $string != *"directory"* ]]
it interprets as if the directory is not within string. Why? How can I solve this issue?
EDIT:
I feel really silly about this, I actually had made a few changes to my script, using the forward slash one of them and I could not figured out what was wrong for about an hour and after one of you mentioned it should work like this I realised it was because somewhere in the middle I had reassigned the variable to something else, that's why it wasn't picking it up.
Perhaps I will delete this question, as it really was my fault and I don't feel it will add much to anyone!