LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   why i get syntax error: unexpected end of file ?? (https://www.linuxquestions.org/questions/linux-newbie-8/why-i-get-syntax-error-unexpected-end-of-file-816118/)

freephys 06-24-2010 08:23 AM

why i get syntax error: unexpected end of file ??
 
I kept getting " syntax error: unexpected end of file" for the last line. it is a empty line. even if i delete that empty line, it complains for the last non-empty line. what is wrong?

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions
PYTHONPATH=/home/mine/Softwares/p25/

source /etc/profile
#history related
export HISTIGNORE="[ \t]*:&:history:exit"
alias ll='ls -l --color=tty'
alias l.='ls -d .* --color=tty'
alias f='find . -name'
alias fi='find . -iname'
alias xtop='xterm -e top &'

#function gfn(){
#find . -name $2 -print0 | xargs -0 -e
#grep -n -e $1
#}
#
#function xtail(){
#xterm -e "tail -f $1" &
#}


sycamorex 06-24-2010 08:36 AM

Hi and welcome to LQ.

I think you're asking too much of us. My eyesight is still quite good, but I can't see a thing of your code. Can you use a normal font colour and wrap it in the [code] tags, please?


edit: I think it's the browser I'm using. Anyway, I'd be better to use the code tags. That's what they are for.

David the H. 06-24-2010 08:49 AM

As sycamorex said, please don't use color tags to print the code. It's almost impossible to read that color. Please put [code][/code] tags around it instead.

"Unexpected end of file" usually means that you forgot to put the proper closing on a command string. That is, you're missing a closing quote-mark, bracket, or loop ender like "done", "esac", or "fi". The shell keeps looking until it finds an appropriate closing mark, or it reaches the end of the file. In quotes especially, there's sometimes a cascading effect, as it steps from quote to quote off-and-on until the last one mismatches.

I don't see anything in the above like that, and it imports just fine for me. But since it does source /etc/bashrc and /etc/profile, you'll need to look there as well.


As an aside, I see the HISTIGNORE variable has the "[ \t]*:&:" trick to ignore duplicates and entries starting with spaces. But you can now set a separate HISTCONTROL variable to control that behavior. It even allows a new value, "erasedups", to remove the previous history entries, so that the commands you enter stay near the top of the stack. Check it out in the bash man page.

Bratmon 06-24-2010 09:03 AM

Quote:

Originally Posted by sycamorex (Post 4013618)

edit: I think it's the browser I'm using.

No I'm almost positive it's the [color="wheat"] tags
this is a test.


All times are GMT -5. The time now is 12:31 AM.