Shell Script : Syntax error near unexpected token 'fi' | Syntax error : unexpected end of file

Опубликовано: 24 Март 2026
на канале: HOW TO
3,671
16

In bash script or shell scripting, some time all code is correct but you find Syntax error : unexpected end of file and when you clear the unwanted spaces and line error didn't resolve or you can also resolve this error by using dos2unix command in bash which will ignore this kind of error.

Sometime you face Syntax error near unexpected token 'fi' error when your code is correct then simple use following command

command :
sudo apt-get install dos2unix
dos2unix filename

If you didn't understand anything kindly let me know