Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-24-2010, 08:23 AM   #1
LQ Newbie
Registered: Jun 2010
Posts: 1

Rep: Reputation: 0
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

# User specific aliases and functions

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" &

Old 06-24-2010, 08:36 AM   #2
LQ Veteran
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,819
Blog Entries: 1

Rep: Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209
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.

Last edited by sycamorex; 06-24-2010 at 08:42 AM.
Old 06-24-2010, 08:49 AM   #3
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959
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.
Old 06-24-2010, 09:03 AM   #4
Registered: Jul 2009
Distribution: Arch / Mint 17
Posts: 297
Blog Entries: 3

Rep: Reputation: 50
Originally Posted by sycamorex View Post

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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
-bash: *.sh: line 25: syntax error: unexpected end of file prashanth212 Linux - General 8 04-05-2010 11:52 PM
bash line 74: syntax error: unexpected end of file help? andycol Linux - General 5 09-14-2009 08:12 AM
syntax error: unexpected end of file ygdrazil Linux - Newbie 3 07-23-2009 05:00 AM
Bash script -----------syntax error: unexpected end of file ArthurHuang Programming 2 05-01-2009 10:29 AM

All times are GMT -5. The time now is 11:59 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration