If statement

Hi,

I'm looking for some help with an if statement as below, which I'm struggling to get working in one statement.

 
 if [ ${d1arc} -eq 0 ] -a [ ${d1} -eq 0 ] || [ ${d2} -eq 0 ] -a [ ${d2arc} -eq 0 ]
                 then
                    echo "file generation failed"
 fi
 

If its not possible in one if statement then I will have to split down in two but would be interested to know.

Thanks in advance.

it miss the [] around the command if

Try using && instead of -a and group with parentheses:

if ( [ ${d1arc} -eq 0 ] && [ ${d1} -eq 0 ] ) || ( [ ${d2} -eq 0 ] && [ ${d2arc} -eq 0 ] )
then
  echo "file generation failed"
fi

If you're sure there's no negative values, in bash you could try

if (( (d1arc+d1)*(d2+d2arc) )) ; then :; else printf "file gen failed\n"; fi

-a and -o work inside the [ ], outside it is && and ||

if [ ${d1arc} -eq 0  -a  ${d1} -eq 0 ] || [ ${d2} -eq 0  -a  ${d2arc} -eq 0 ]
if [[ ( ${d1arc} -eq 0 && ${d1} -eq 0 ) || ( ${d2} -eq 0 && ${d2arc} -eq 0 ) ]]; then
echo "file generation failed"
fi

Much appreciated all.