LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-21-2004, 12:10 PM   #1
rwalkerphl
Member
 
Registered: Jun 2004
Location: NJ, US (Ex UK)
Distribution: RHEL3.0 / FC2
Posts: 79

Rep: Reputation: 15
Error when logging in to terminal


Hi,

Apologies, but I have a real newbie question here...

When I logging in using a terminal or terminal emulator, I get the following error:

-bash: /etc/profile: line 27: syntax error: unexpected end of file

it doesn't seem to cause any problems (that I can tell), but is there any way I can stop this. Here is the contents of the profile file:

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|$1($|" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi#

if [ $LD_LIBRARY_PATH ]
then
if ! set | grep LD_LIBRARY_PATH | grep /usr/X11R6/lib:/usr/X11R6/lib/modules > /dev/null
then
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/X11R6/lib:/usr/X11R6/lib/modules
export LD_LIBRARY_PATH
fi
else
LD_LIBRARY_PATH=/usr/X11R6/lib:/usr/X11R6/lib/modules
export LD_LIBRARY_PATH
fi

Thanks,

Robin.
 
Old 06-21-2004, 04:09 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,865

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
Does /etc/profile have any blank lines after the last fi statement? You may have a seemingly blank line with an unprintable character in it that is triggering the error message.

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites
 
Old 06-22-2004, 04:09 PM   #3
rwalkerphl
Member
 
Registered: Jun 2004
Location: NJ, US (Ex UK)
Distribution: RHEL3.0 / FC2
Posts: 79

Original Poster
Rep: Reputation: 15
I vim'd the file, and found a blank line, removed it, but am still getting the error...
 
Old 06-22-2004, 04:32 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
It looks like you (or someone else) tinkered with the file. Whomever did the edits killed a closing curly brace '}' and didn't replace it. The pathmunge function starts with an open curly brace, but there is no closing one. I would assume it was supposed to go after the "fi#" line.

Then again, pathmunge is never used in the commands that follow. So, I can't say with any certainty where the closing curly brace is supposed to go.
 
Old 06-22-2004, 05:04 PM   #5
rwalkerphl
Member
 
Registered: Jun 2004
Location: NJ, US (Ex UK)
Distribution: RHEL3.0 / FC2
Posts: 79

Original Poster
Rep: Reputation: 15
I tried adding a curly bracket after the fi# or at the end of the file. I got an error that ot wasn't expecting the bracket there in both cases...
 
Old 06-22-2004, 05:17 PM   #6
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Ok, try this:

Code:
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
  path_contents=`echo $PATH | /bin/egrep -q "(^|$1($|"`
  if [ "${path_contents}x" = "x" ] ; then
    if [ "$2" = "after" ] ; then
      PATH=$PATH:$1
    else
      PATH=$1:$PATH
    fi
  fi
}

if [ $LD_LIBRARY_PATH ] ; then
  expected_libs_found=`set                                         | \
                       grep LD_LIBRARY_PATH                        | \
                       grep /usr/X11R6/lib:/usr/X11R6/lib/modules`
  if [ "${expected_libs_found}x" = "x" ] ; then
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/X11R6/lib:/usr/X11R6/lib/modules
    export LD_LIBRARY_PATH
  fi
else
  LD_LIBRARY_PATH=/usr/X11R6/lib:/usr/X11R6/lib/modules
  export LD_LIBRARY_PATH
fi
I get no errors when I source this version of the file. I made some changes; I don't know if you can issue an if statement without an open-close pair of square brackets '[ ]'. Assuming I interpreted things correctly, it should do what was intended in the original.
 
Old 06-22-2004, 07:04 PM   #7
rwalkerphl
Member
 
Registered: Jun 2004
Location: NJ, US (Ex UK)
Distribution: RHEL3.0 / FC2
Posts: 79

Original Poster
Rep: Reputation: 15
That worked just fine! Thanks very much for your time and help!
 
Old 06-22-2004, 07:07 PM   #8
rwalkerphl
Member
 
Registered: Jun 2004
Location: NJ, US (Ex UK)
Distribution: RHEL3.0 / FC2
Posts: 79

Original Poster
Rep: Reputation: 15
I found the problem. it was a comination of the missing '}', and the '#' after the if halfway down the file.

Again, many thanks for your help.
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Logging on as root from The Terminal bobbasic2002 Linux - General 3 03-16-2014 06:44 PM
X Terminal Session Logging phiw1123 Linux - Software 1 04-26-2005 03:15 PM
logging a terminal session Louis_Carole Linux - Newbie 1 11-16-2004 03:28 PM
Terminal is dark after logging out of X shimmyt Linux - General 2 09-14-2003 04:05 PM
terminal history logging alue Linux - General 4 03-15-2002 01:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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