7.3. Other Comparison Operators
some more to look at ..
the use of the ! (not) in that example is correct logic. If you are checking for something that is 'not' to be true. In other words, if the value you're looking for is not there then it returns 'true' then act upon it accordingly.
Code:
if [[ ! -w ${file} ]] ; then
if it is not working then:
The question then is the code to get the value into your variable named 'file'. if the value within the variable is there and correct, then it is your logic that is now backwards.
Logical Not !