name
name

Reputation: 31

.profile: line 31: syntax error: unexpected end of file

I'm bad at bash programming. Where is the error? Here is my .profile file:

# WARNING: For help understanding this file, and before you try
# to change any of it, type "man .profile" and read carefully.
#

#
# Set command search rules
#
if [ -x /bin/showpath ] ; then  
    export PATH; PATH=`/bin/showpath $HOME/bin /u/cs350/sys161/bin /software/gnu/bin standard`
    export PATH; PATH=`/bin/showpath usedby=user standard $HOME/bin`
#
# Find out what kind of terminal we are using
#
    eval `setterm  sytek:kd404  default:vc404`
#
# Set terminal-type dependent options (e.g. sysline or prompt string)
#
    #HOMEHOST="<hostname>"
    #HOMEUSER="<userid>"
    #export HOMEHOST HOMEUSER
    PS1="$ "
#
# Now do the usual signing on things
#
    export MAIL; MAIL=${MAIL-"/usr/spool/mail/$USER"}

if [ -r /software/.admin/bins/bin/read_system_news ] ; then /software/.admin/bins/bin/read_system_news ; fi

EOF

Upvotes: 3

Views: 9559

Answers (2)

codaddict
codaddict

Reputation: 454940

You are missing a fi at the end of file add it.

Also get rid of EOF. The EOF in your case is treated as a command.

Sometimes running your script using different shells gives you a clue about the error.

When we run your program using:

  • sh it says Syntax error: end of file unexpected (expecting "fi")
  • csh it says if: Expression Syntax.

Upvotes: 4

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798516

Your first if is missing a fi.

Upvotes: 7

Related Questions