PDA

View Full Version : Bash: Missing `]'



duke.tim
June 11th, 2013, 05:53 PM
Does anyone see what is wrong with this line of code? I have no idea what is wrong.


if [ ${Array[$xSrcIP]} == "$SrcIP" && ${Array[$yDstIP]} == "$DstIP" ] ;then


./script.sh: line 5: [: missing `]'

The normal issue is missing spaces but i'm not missing spaces.

duke.tim
June 11th, 2013, 05:59 PM
Whoops never mind just saw what was wrong



if [ "${Array[$xSrcIP]}" == "$SrcIP" ] && [ "${Array[$yDstIP]}" == "$DstIP" ] ;then