We have cgi application written in bash scripts. I am trying to understand how the code snippet below works. Basically its a dropdown menu and the choices is governed by _getDocType logic. How does the function take the value for "imgCodeStr"? All of this code is under one cgi file written in bash.
HTML generating function
<select id="docType" name="doctype" style="width:100%">
$(_getDocType)
</select>
where _getDocType function definition is
_getDocType()
{
tmpIfs=IFS
IFS="#" docCodeArr=($imgCodeStr) <-- Please explain this specifically
IFS=tmpIfs
for (( i=0; i<${#docCodeArr[*]}; i++ ))
do
echo "<option value=\"${docCodeArr[$i]}\">${docCodeArr[$i]}"
echo "</option>"
done
}
tmpIfs=IFSandIFS=tmpIfsshould betmpIfs=$IFSandIFS=$tmpIfs. This would bite you if the rest of the script relied on the value ofIFS.