I am reading some other developer script and I run across something I dont quite understand. Please help
typeset -u DOC_RET_CODE=`grep ^${PRNT_JOB_NAME}${SEQ_NUM} ${INPUT_FILE} |cut -c273-276`
if [ "${DOC_RET_CODE}" = "GOOD" ]
I look up typeset – u and it seems like it generate read-only variable, but not sure what it doing there. For grep, I usually pipe an input like ls | grep test, but grep by itself like this, I am not so sure. I know cut -c273-276, but 4 characters out from position 273-276. So what exactly does this script do?
The back-tick command (which would be better enclosed in
$(...)) is grepping for a line starting with the print job name and sequence number from the input file, and then the ‘cut’ command is collecting columns 273-276 (4 characters). The upper-case version of this value (typeset -u) is assigned to$DOC_RET_CODE. The test line checks whether the document return code is GOOD and does something (not shown) if it is … and maybe something else if the status is not good.