Found keywords like 'done', 'then', 'fi', and 'esac' used as arguments in commands, causing the shell to treat them as literal strings instead of keywords. For example, in echo '$f' done, the keyword done is not recognized as terminating the loop. This issue is fixed by terminating the preceding command with a semicolon, ensuring the keyword starts a new line.
1
2# Noncompliant: `fi` is treated as an argument to echo, not terminating the `if` statement.
3if [ -f "file.txt" ]
4then
5 echo "File exists" fi
6 echo "This always runs"1
2# Compliant: `fi` properly terminates the `if` statement.
3if [ -f "file.txt" ]
4then
5 echo "File exists"
6fi
7echo "This runs after the if statement"