Unix/Linux Go Back    


BSD BSD, sometimes called Berkeley Unix, is a Unix operating system developed by the Computer Systems Research Group of the UC Berkeley.

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

BSD


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 06-08-2017
getzeeshan getzeeshan is offline
Registered User
 
Join Date: Jun 2017
Last Activity: 9 June 2017, 10:04 AM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Keep getting error "-bash: ./.profile_z2: line 52: syntax error: unexpected end of file"


Code:
#!/bin/bash
#--------------------------------------------------------
# Setup prompt
# Author Zeeshan Mirza
# Data: 06-08-2017
#--------------------------------------------------------
if [ -f .profile_custom_pre ]
then
   . ./.profile_custom_pre
fi

umask 022
set -o vi
export EDITOR=vi
export VISUAL=vi
export PS1='hostname':'$PWD
$ORACLE_SID > '

set -o vi
stty erase "^?"
if [ `uname` = SunOS ]
then
   export etcpath=/var/opt/oracle
else
   export etcpath=/etc
fi

.$etcpath/oraInst.loc

export CRS_HOME=`egrep "CRS|GRID" $inventory_loc/ContentsXML/inventory.xml|awk -F'"' '{print $4}'`
export CRS_HOME=`grep agent $inventory_loc/ContentsXML/inventory.xml|awk -F'"' '{print $4}'`
export HOST_NAME='hostname|awk -F'.' '{print $1}''
export PATH=$PATH:/usr/local/bin
export HISTSIZE=10000
export HISTFILE=$HOME/.sh_history

if [ $DEFAULT_ORACLE_SID = "" ]
then
   export ORACLE_SID=`cat $etcpath/oratab|egrep -vi "#|^$|asm|crs|agemt"|grep ":/"|awk -F':' '{print $1} |head -1`
else
   export ORACLE_SID=$DEFAULT_ORACLE_SID
fi

export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

echo  "================================="
echo  "run this script to set aliases"
echo  "source ~oracle/aliases"
echo  "================================="


Moderator's Comments:
Keep getting error "-bash: ./.profile_z2: line 52: syntax error: unexpected end of file" Please use CODE tags as required by forum rules!

Last edited by RudiC; 06-08-2017 at 04:56 PM.. Reason: Added CODE tags.
Sponsored Links
    #2  
Old Unix and Linux 06-08-2017
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 25 September 2017, 12:15 PM EDT
Location: Saskatchewan
Posts: 22,421
Thanks: 1,127
Thanked 4,240 Times in 3,920 Posts

Code:
export ORACLE_SID=`cat $etcpath/oratab|egrep -vi "#|^$|asm|crs|agemt"|grep ":/"|awk -F':' '{print $1} |head -1`

Missing a quote.


Code:
export ORACLE_SID=`cat $etcpath/oratab|egrep -vi "#|^$|asm|crs|agemt"|grep ":/"|awk -F':' '{print $1}' |head -1`

The Following User Says Thank You to Corona688 For This Useful Post:
jim mcnamara (06-08-2017)
Sponsored Links
    #3  
Old Unix and Linux 06-08-2017
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 25 September 2017, 11:49 AM EDT
Location: San Jose, CA, USA
Posts: 10,509
Thanks: 544
Thanked 3,676 Times in 3,136 Posts
In addition to what Corona688 already said, the line:

Code:
.$etcpath/oraInst.loc

should probably be:

Code:
. $etcpath/oraInst.loc

and the line:

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

should either be:

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

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

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

to match recommended practices, or:

Code:
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::

Code:
export HOST_NAME=${PS1%%.*}

    #4  
Old Unix and Linux 06-09-2017
getzeeshan getzeeshan is offline
Registered User
 
Join Date: Jun 2017
Last Activity: 9 June 2017, 10:04 AM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks! let me fix these things and get back to you'll

--Zee

Last edited by Don Cragun; 06-09-2017 at 01:59 PM.. Reason: Remove duplicated post.
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Error"syntax error at line 15: `end of file' unexpected" millan Shell Programming and Scripting 5 05-31-2013 04:14 AM
Help with FTP Script which is causing "syntax error: unexpected end of file" Error mahi_mayu069 Shell Programming and Scripting 1 04-25-2013 07:27 AM
Help with error "syntax error: unexpected end of file" mahi_mayu069 Shell Programming and Scripting 2 04-25-2013 07:03 AM
Bash (Ubuntu server): Syntax error: "|" unexpected in While-loop primaxx Shell Programming and Scripting 3 09-19-2011 03:20 PM
"syntax error at line 21 :'done' unexpected." error message" ibroxy Shell Programming and Scripting 3 08-08-2007 06:45 AM



All times are GMT -4. The time now is 12:57 PM.