Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I followed this tutorial to add a JAVA variable for all users. I then opened the editor that my hosting service supplies and added the last 2 lines. Centos 5.9 server.

# /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
}

# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then 
    EUID=`id -u`
    UID=`id -ru`
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /sbin
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
fi

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

if [ -x /usr/bin/id ]; then
    USER="`id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then
            . $i
        else
            . $i >/dev/null 2>&1
        fi
    fi
done

unset i
unset pathmunge
#cPanel Added local::lib -- BEGIN
LOCALLIBUSER=$USER
if [ -e "/usr/bin/whoami" ]; then
        LOCALLIBUSER=`/usr/bin/whoami`
fi
if [ "$LOCALLIBUSER" != "root" ]; then
    eval $(perl -Mlocal::lib)
fi
#cPanel Added local::lib -- END

export PATH=$PATH:/opt/java/jdk1.6.0_41/bin
export PATH=$PATH:/opt/java/jdk1.6.0_41/bin

After I relog in I get:

enter image description here

The problem is that I need to configure the Java home variable. I am still getting that error even if I delete what I added on the last two lines. Thanks.

share|improve this question
    
Would it be possible to strip your init file down to the parts that actually cause the error? –  slhck Feb 28 '13 at 21:16
    
"the editor that my hosting service supplies" - what is that? Any chance it could have messed with the line endings? –  Mat Feb 28 '13 at 21:21
    
Im not sure what editor is it, but its just a text editor. Then I typed in the last two lines that the tuturial stated. –  wtsang02 Feb 28 '13 at 21:25
2  
Well, for one, you don't need that line twice. –  ÃŁŁǫǛȉЖΦΤїҪ Feb 28 '13 at 21:35
add comment

1 Answer 1

up vote 1 down vote accepted

It looks very much like the editor you used changed newline (‘\n’) characters (which are numerically equal to line-feed (LF) characters) with CR+LF sequences (CR = carriage return).  In their totality, the error messages you showed don’t make a lot of sense, but this portion jumped out at me:

…bash: /etc/profile: line 6: syntax error near unexpected token `{
'

That’s saying that the “unexpected token” is a { followed by a CR.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.