Shellscript: Conditional operator: What is wrong in following shellscript if statement

Viewed 40

Here is my shellscript if condition

if [[ $RBFilePath =~ \.js$ || $RBFilePath =~ \.json$ && ${#key_array[0]} = "JAVASCRIPT" ]]; then
Blah blah
blah blah

fi

What I want here is, if $RBFilePath ends with .js or .json AND First elemeny of array: key_array is equal to "JAVASCRIPT" then execute the if block.

But it is not executing. Can someone please help telling me issue.?

1 Answers
Related