If statement failing with error "pc.sh[21]: [yscc02 =yscc02]: not found."


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting If statement failing with error "pc.sh[21]: [yscc02 =yscc02]: not found."
# 1  
Old 09-20-2012
If statement failing with error "pc.sh[21]: [yscc02 =yscc02]: not found."

Dear all

I wrote a shell script which runs perfect in OEL linux 5.2 but its failing in AIX 5.3

this scripts check if db is up then it wont proceed else proceed with rest steps.

any help is appreciated.
--------------------------------------------
Code:
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/101
ORACLE_SID=yscc02
NLS_LANG=AMERICAN_AMERICA.AR8MSWIN1256
export ORACLE_BASE ORACLE_HOME NLS_LANG ORACLE_SID

PATH=/usr/bin:/etc:/usr/sbin:/usr/local/bin:/usr/local/sbin:$ORACLE_HOME/bin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.


export PATH ORACLE_HOME ORACLE_BASE ORACLE_SID

status=`ps -ef |grep -v grep |grep smon |awk -F"_" '{print $3}'`

alias pcl="tail -f /home/oracle/kaleem/audit/power_crash_$$.log"

#if [ "$status" == "$ORACLE_SID" ]; then

if ["$status"="$ORACLE_SID"]; then
        echo " Database : $ORACLE_SID is already running "
else
        echo " Please wait until db is open and follow the instructions printing down."
        echo
        echo "open a new terminal with `whoami`/`whoami` and run "al" "
        echo
        echo "open another termial with `whoami`/`whoami` and run "pclog" "
        echo

        sleep 20
        echo
        echo
        sh /home/oracle/kaleem/admin/recover_crash_aix.sh

        echo
        echo " The details log file you can be seen here"
        echo "location : /home/oracle/kaleem/audit/power_crash_$$.log"
        echo
        echo "---------------- Finished ----------------"

fi

----------------------------------------
script failed message:
-----------------------------------
Code:
$ sh pc.sh
+ ORACLE_BASE=/u01/app/oracle
+ ORACLE_HOME=/u01/app/oracle/product/101
+ ORACLE_SID=yscc02
+ NLS_LANG=AMERICAN_AMERICA.AR8MSWIN1256
+ export ORACLE_BASE ORACLE_HOME NLS_LANG ORACLE_SID
+ PATH=/usr/bin:/etc:/usr/sbin:/usr/local/bin:/usr/local/sbin:/u01/app/oracle/product/101/bin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.
+ export PATH ORACLE_HOME ORACLE_BASE ORACLE_SID
+ + ps -ef
+ grep smon
+ grep -v grep
+ awk -F_ {print $3}
status=yscc02
+ alias pcl=tail -f /home/oracle/kaleem/audit/power_crash_544818.log
+ [yscc02 =yscc02]
pc.sh[21]: [yscc02 =yscc02]:  not found.
+ echo  Please wait until db is open and follow the instructions printing down.
 Please wait until db is open and follow the instructions printing down.
+ echo

+ whoami
+ whoami
+ echo open a new terminal with oracle/oracle and run al
open a new terminal with oracle/oracle and run al
+ echo

+ whoami
+ whoami
+ echo open another termial with oracle/oracle and run pclog
open another termial with oracle/oracle and run pclog
+ echo

+ sleep 20
^C$


Last edited by Franklin52; 09-20-2012 at 04:50 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 09-20-2012
Space required in square brackets..

Code:
if [ "$status" == "$ORACLE_SID" ]

better to use double square brackets..
Code:
if [[ "$status" == "$ORACLE_SID" ]]

# 3  
Old 09-20-2012
Dear Pamu.

Thanks Pamu space in square brackets worked.

Best Regards
Kaleem.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script fails with "function: not found" error

Hello everyone, I am having problems figuring this out. This script below is supposed to create a list of file names with their "md5sum", in a file "lib-list.txt" When I run it "sh component-list.sh " I get this:component-list.sh: 4: component-list.sh: function: not found component-list.sh:... (4 Replies)
Discussion started by: joemb
4 Replies

2. Shell Programming and Scripting

Source command returns error when it strikes conditional statement "ifeq"

Hello All, I am running source command on my project configuration file app.cfg which has conditional statements with make file systax E.g ifeq ($(APP_CMP_DIR),trunk). When I source this file it throws error: syntax error near unexpected token... (1 Reply)
Discussion started by: anand.shah
1 Replies

3. Red Hat

Could interrupt disabled cause "opreport error: No sample file found"?

Hi All I would like to profile my application with oprofile but I can't since no samples are collected. The kernel of my app is 2.6 on RED HAT Enterprise 5.3 (Tikanga) so OProfile is setup in timer interrupt mode # opcontrol --list-events Using timer interrupt. I... (0 Replies)
Discussion started by: manustone
0 Replies

4. HP-UX

DLT 7000 tape drive failing with "write error on a record in the index"

HP rp5450 (L2000) running HP-UX 11.11B Using DLT 7000 and DLT 4000 tape drives for nightly full backups Backup jobs created by SAM DLT 7000 cron entry is as follows: 00 2 * * 1-6 /usr/sam/lbin/br_backup DLT FULL Y /dev/rmt/0m /var/sam/graphLCAa17036 root Y 1 N > /var/sam/SAM_br_msgs 2>&1... (1 Reply)
Discussion started by: dreh99
1 Replies

5. Shell Programming and Scripting

sendmail script throwing an error "No recipient addresses found in header"

Hi, I am using following code to send an e-mail with attachment and body. echo "To: user1@mail.com,user2@mail.com" > mail.tmp echo "Cc: user3@mail.com,user4@mail.com" >> mail.tmp echo "From: group@mail.com" >> mail.tmp echo "Subject: my report" >> mail.tmp echo "please see as attached"... (6 Replies)
Discussion started by: vivek_damodaran
6 Replies

6. Shell Programming and Scripting

ksh93 if statement gives "not found" error

Why do I get the error on the second example?. This works: if ];then > echo "true" > else > echo "false" > fi true This doesn't, and gets the error shown: if ];then > b=1 > else > b=0 > fi -ksh93: line 2: . b=1: not found. (1 Reply)
Discussion started by: R.T.
1 Replies

7. Red Hat

"No Drives Found" error during Redhat Linux AS 4 installation

I'm trying to install Redhat LInux AS 4 update 4 on an IBM x306 series server. I keep getting following error: "No Drives Found. An error has occurred - no valid devices were found on which to create new file systems. Please check your hardware for the cause of this problem." I called IBM and... (2 Replies)
Discussion started by: pieman8080
2 Replies

8. UNIX for Dummies Questions & Answers

why emacs caused "command not found" error

I installed Red Hat Enterprise Linux 5 on my PC. When i typed 'emacs' on the console, "command not found" error occurrd. Why. :mad: (1 Reply)
Discussion started by: cy163
1 Replies

9. Solaris

Network Path Not Found Error "Sunfire V100"

I recently got this new old server from a friend. I just installed a fresh version of Solaris 10 on it. I have put a static IP of 192.168.100.10 the server. Their is no subnetting scheme on the network. And I made the hostname "SunServ." And I also changed the folder "/etc/inet/hosts" because I... (4 Replies)
Discussion started by: louisd11
4 Replies
Login or Register to Ask a Question