#!/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 "================================="
export ORACLE_SID=`cat $etcpath/oratab|egrep -vi "#|^$|asm|crs|agemt"|grep ":/"|awk -F':' '{print $1} |head -1`
Missing a quote.
export ORACLE_SID=`cat $etcpath/oratab|egrep -vi "#|^$|asm|crs|agemt"|grep ":/"|awk -F':' '{print $1}' |head -1`
1 Like
In addition to what Corona688 already said, the line:
.$etcpath/oraInst.loc
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%%.*}
1 Like
Thanks! let me fix these things and get back to you'll
--Zee
1 Like