I think this is really hard to debug as one line, so I split it up the best I can. Here is what I have so far. Please modify this into your script and test some more. I really can't do much more without knowing what the rest of the script does.
Code:
if [[ (("$ssh_to" = "<server_address>")) ]] &&
egrep -n "oneclass_.*" $current_cos &&
egrep -z "oneclass_.*" ${avail_cos_arr[$(( $cos_choice-1)) ]} \
-o "$ssh_to" = "<server address>" &&
egrep -n "secondclass_.*" \
$current_cos && egrep -z "secondclass_.*" \
${avail_cos_arr[$(($cos_choice-1))]} ]]; then
echo 'It did work' >> /dev/null
fi
What I did was break this into multiple lines, run it a couple of times and find out where you had extra parenthesis or missing parenthesis. Changed the egrep to
egrep
[option] instead of
[option] egrep, and ran it again. I don't know if it really works, but it doesn't syntax error out.
- Raj