sanctiondecision Posted September 5, 2023 Posted September 5, 2023 for some reason a script I have fails with a syntax error. Unfortunately no further explanation of what or where the syntax error is: ~$ sudo bash *****.bash test1 *****.bash: line 13: syntax error: unexpected end of file I have been able to reproduce the issue with this minimal script: #!/bin/bash # option vars silentInstallation=true # work in progress apt_options=() echo "test1" if [ "$silentInstallation" = true ] then echo "choosing silent installation" apt_options=(-qq) fi echo "updating packages" The script seems to do fine until if [ "$silentInstallation" = true ] I have looked at other questions but cannot find the following things: no open parentheses no unclosed if statement no missing line break I am quite sure this script worked before. Just now, sanctiondecision said: for some reason a script I have fails with a syntax error. Unfortunately no further explanation of what or where the syntax error is: ~$ sudo bash *****.bash test1 *****.bash: line 13: syntax error: unexpected end of file I have been able to reproduce the issue with this minimal script: #!/bin/bash # option vars silentInstallation=true # work in progress apt_options=() echo "test1" if [ "$silentInstallation" = true ] then echo "choosing silent installation" apt_options=(-qq) fi echo "updating packages" The script seems to do fine until if [ "$silentInstallation" = true ] I have looked at other questions but cannot find the following things: no open parentheses no unclosed if statement no missing line break I am quite sure this script worked before. Unexpected end of file error thanks in advance for any help
kiynox Posted September 7, 2023 Posted September 7, 2023 [ @sanctiondecision ] --- Quote unexpected end of file Judging from this, it looks like the bash file you created has a problem with EOL (End of Line). Since bash is based on UNIX, you need to do EOL conversion from DOS to UNIX. The difference: DOS (Windows) uses CRLF as it's end of line, UNIX (Linux) uses LF and Machintosh uses CR. --- Please put your code under "Code (<>)" markings for readability. ---
Recommended Posts
Archived
This topic is now archived and is closed to further replies.