I do agree
Yep .. You miss something here.
First I executed the arsdoc query without using eval command. But when I execute the query string that is generated dynamically in the script the shell interprets the whole value as string and ended up with this error.
$ABSPATH/arsdoc query -h $HOSTNAME -u $USERNAME -p $PASSWORD -f "${lineb}" -N "(${primarykey})(${FIELD})" -i "where ${primarykey}='${linea}'" -o "${OUTDIR}/${linea}${folname}.
ARS6054E The header format is invalid. Syntax is as follows (Parentheses are required):
(ag_name1)(ag_name2)(ag_name3)But actually there is no error in the command that was generated as it produces result in the command window for CMOD
Finally found that the shell interprets it as a string rather individual parameters for arsdoc command.
Hence used eval command wherein the shell is able to interpret the parameters in the right way for arsdoc command and it produced the result.
r=$(echo "query -h $HOSTNAME -u $USERNAME -p $PASSWORD -f \"$lineb\" -N \"($primarykey)($FIELD)\" -i \"where $primarykey='$linea'\" -o \"$OUTDIR/$linea$folname.txt\"")
eval "$ABSPATH/arsdoc $r"Hope that justifies why I used eval command
- Jim.