Home Man
Search
Today's Posts
Register

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"

Tags
bsd

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 06-08-2017
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.
# 2  
Old 06-08-2017
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)
# 3  
Old 06-08-2017
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 (12-12-2017)
# 4  
Old 06-09-2017
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.
The Following User Says Thank You to getzeeshan For This Useful Post:
dodona (12-12-2017)
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Error: "Syntax error; unexpected end of file" Pradeep_Raj Shell Programming and Scripting 1 03-15-2018 05:49 AM
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
Syntax error near unexpected token `"Hit <ENTER> to continue:"' lathigara Shell Programming and Scripting 7 07-31-2012 05:52 PM
Bash (Ubuntu server): Syntax error: "|" unexpected in While-loop primaxx Shell Programming and Scripting 3 09-19-2011 03:20 PM
Syntax error: word unexpected (expecting ")") figaro Shell Programming and Scripting 9 03-06-2009 02:18 PM
"syntax error near unexpected token `fi' " GIC1986 Solaris 4 09-19-2008 12:17 PM
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 11:16 AM
"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 01:20 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password