LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash: unexpected end of file --fix (https://www.linuxquestions.org/questions/linux-newbie-8/bash-unexpected-end-of-file-fix-682372/)

BeacoN 11-10-2008 09:53 AM

bash: unexpected end of file --fix
 
hey guys....this is just sharing what I've found. I pulled my hair out trying to figure out what was causing this error. One reason is a comment that is right after a block (most times this is the case for me). similar to my java programming I do it to clarify the matching } like...
function myFunk {
... code ...
}#end myFunk
well this works fine for the java compiler, but Bash throws a temper tantrum like a 5 year old brat in the walmart candy aisle. so, all you have to do is add some good ol' whitespace...
function myFunk {
... code ...
} #end myFunk
and the brat gets his candy :-)

colucix 11-10-2008 11:31 AM

I think this is because of the other meanings of the hash symbol in bash, as in parameter substitution and for specifying the base of a numerical constant. The problem arises every time you have an inline comment not preceded by a blank space, not only at the end of a function definition.


All times are GMT -5. The time now is 08:42 AM.