Unix/Linux Go Back    

Keep getting error "-bash: ./.profile_z2: line 52: syntax error: unexpected end of file"


Kindly Note - This is a Single User Post by Forum Member Don Cragun Regarding:
Keep getting error "-bash: ./.profile_z2: line 52: syntax error: unexpected end of file".
Please Follow The Primary Link Above to View the Full Discussion.

Old Unix and Linux 06-09-2017   -   Original Discussion by getzeeshan
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Join Date: Jul 2012
Last Activity: 23 February 2018, 6:37 AM EST
Location: San Jose, CA, USA
Posts: 11,083
Thanks: 618
Thanked 3,864 Times in 3,306 Posts
In addition to what Corona688 already said, the line:


should probably be:

. $etcpath/oraInst.loc

and the line:

export HOST_NAME='hostname|awk -F'.' '{print $1}''

should either be:

export HOST_NAME=`hostname|awk -F'.' '{print $1}'`

to match the rest of your code (note backquotes instead of single-quotes), or:

export HOST_NAME=$(hostname|awk -F'.' '{print $1}')

to match recommended practices, or:

export HOST_NAME=${PS1#.*}

or, since you have already set the 1st part of PS1 to the output from the hostname command, much more efficiently::

export HOST_NAME=${PS1%%.*}

The Following User Says Thank You to Don Cragun For This Useful Post:
dodona (12-12-2017)