I have found this error alongside couple more. I believe that the nesting is not quite all right or the for is not correctly indented or without some semicolon. Either way I have tried for quite some time to figure it out, but to no avail. Here is the code:if [ ${runcmd} != echo ]; thenstatusmsg Kernels built from ${kernelconf}:kernlist=$(awk '$1 == config { print $2 }' ${kernelconfpath}) for kern in ${kernlist:-netbsd}; do[ -f ${kernelbuildpath}/${kern} ] && \echo  ${kernelbuildpath}/${kern}done | tee -a ${results}fiIt is part of a build.sh file.
Shell script - Couldn't find 'fi' for this 'if'
shell;shell script;for
The var=value cmd ar1syntax doesn't quite seem to work if cmd is a for loop (in neither bash nor sh).Both sh and bash give syntax errors for:foo=bar for f in ${foo:-BAR}; do echo $f; donewhich is what you're esentially doing.(sh: 1: for: not foundbash: syntax error near unexpected token `do')And that error seems to result in a couldn't find fi error in your case;Setting the variable on a separate line fixes the syntax error:kernlist=$(awk '$1 == config { print $2 }' ${kernelconfpath})for kern in ${kernlist:-netbsd}; do #...Note:I would just write $kernelbuildpath/$kern instead of ${kernelbuildpath}/${kern} if I were you.  There's no technical reason for the curlies.