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


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 06-08-2017   -   Original Discussion by getzeeshan
getzeeshan's Unix or Linux Image
getzeeshan getzeeshan is offline
Registered User
 
Join Date: Jun 2017
Last Activity: 9 June 2017, 10:04 AM EDT
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
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 05:56 PM.. Reason: Added CODE tags.
Sponsored Links
    #2  
Old Unix and Linux 06-08-2017   -   Original Discussion by getzeeshan
Corona688's Unix or Linux Image
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 14 December 2017, 4:58 PM EST
Location: Saskatchewan
Posts: 22,547
Thanks: 1,159
Thanked 4,287 Times in 3,955 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-09-2017   -   Original Discussion by getzeeshan
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 17 December 2017, 5:34 PM EST
Location: San Jose, CA, USA
Posts: 10,790
Thanks: 593
Thanked 3,772 Times in 3,220 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%%.*}

The Following User Says Thank You to Don Cragun For This Useful Post:
dodona (5 Days Ago)
    #4  
Old Unix and Linux 06-09-2017   -   Original Discussion by getzeeshan
getzeeshan's Unix or Linux Image
getzeeshan getzeeshan is offline
Registered User
 
Join Date: Jun 2017
Last Activity: 9 June 2017, 10:04 AM EDT
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Thanks! let me fix these things and get back to you'll

--Zee

Last edited by Don Cragun; 06-09-2017 at 02:59 PM.. Reason: Remove duplicated post.
The Following User Says Thank You to getzeeshan For This Useful Post:
dodona (5 Days Ago)
Sponsored Links
Closed

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 05: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 08:27 AM
Help with error "syntax error: unexpected end of file" mahi_mayu069 Shell Programming and Scripting 2 04-25-2013 08:03 AM
Bash (Ubuntu server): Syntax error: "|" unexpected in While-loop primaxx Shell Programming and Scripting 3 09-19-2011 04:20 PM
"syntax error at line 21 :'done' unexpected." error message" ibroxy Shell Programming and Scripting 3 08-08-2007 07:45 AM



All times are GMT -4. The time now is 09:29 PM.