Sponsored Content
Full Discussion: Problem evaluating condition
Top Forums Shell Programming and Scripting Problem evaluating condition Post 303011990 by edstevens on Saturday 27th of January 2018 08:35:02 AM
Old 01-27-2018
RudiC -
I'm sorry, not x0D but x 0A. It's in the output I posted.

As for the format of /etc/oratab, no it is not created with Windows editor. This is pure linux, and /etc/oratab is a simple text file. Sometimes modified by Oracle utilites, sometimes manually using vi. It looks like this:

Code:
oracle:listener$ cat /etc/oratab
#
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
#
# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#============================================
db11:/u01/app/oracle/product/11.2.0.4/dbhome_1:N
db12:/u01/app/oracle/product/12.1.0.2/dbhome_1:N
listener:/u01/app/oracle/product/12.1.0.2/dbhome_1:N
fs91dmo:/u01/app/oracle/product/11.2.0.4/dbhome_1:N
fs91dev:/u01/app/oracle/product/11.2.0.4/dbhome_1:N
hr92dev:/u01/app/oracle/product/12.1.0.2/dbhome_1:N
fs92upg:/u01/app/oracle/product/12.1.0.2/dbhome_1:N
fs92dev:/u01/app/oracle/product/12.1.0.2/dbhome_1:N
hr92tst:/u01/app/oracle/product/12.1.0.2/dbhome_1:N
fs91upg:/u01/app/oracle/product/12.1.0.2/dbhome_1:N
hr92upg:/u01/app/oracle/product/11.2.0.4/dbhome_1:N

---------- Post updated at 07:35 AM ---------- Previous update was at 07:25 AM ----------

Don -

Requested output follows. Output of uname obfuscated for security.

Code:
oracle:hr92dev$ type echo grep ps
echo is a shell builtin
grep is /bin/grep
ps is /bin/ps

oracle:hr92dev$ uname -n
myserver.myorg.org

oracle:hr92dev$ ORACLE_SID=fs

oracle:fs$ ps -ef|grep '[p]'mon_$ORACLE_SID
oracle    1631     1  0 Jan22 ?        00:00:54 ora_pmon_fs91dmo
oracle    2842     1  0 Jan22 ?        00:00:41 ora_pmon_fs91upg
oracle    4317     1  0 Jan22 ?        00:00:57 ora_pmon_fs91dev
oracle    9786     1  0 Jan04 ?        00:03:09 ora_pmon_fs92upg
oracle   21794     1  0 Jan05 ?        00:03:05 ora_pmon_fs92dev


+ type echo grep ps
echo is a shell builtin
grep is /bin/grep
ps is /bin/ps
+ uname -n
myserver.myorg.org
+ ORACLE_SID=fs
+ ps -ef
+ grep '[p]mon_fs'
oracle    1631     1  0 Jan22 ?        00:00:54 ora_pmon_fs9
oracle    2842     1  0 Jan22 ?        00:00:42 ora_pmon_fs9
oracle    4317     1  0 Jan22 ?        00:00:57 ora_pmon_fs9
oracle    9786     1  0 Jan04 ?        00:03:09 ora_pmon_fs9
oracle   21794     1  0 Jan05 ?        00:03:05 ora_pmon_fs9
egrep -i "product/12" /etc/oratab |grep -v "listener"|      awk -F\: '{print $1}'|sort
++ egrep -i product/12 /etc/oratab
++ grep -v listener
++ awk -F: '{print $1}'
++ sort
+ dblist='db12
fs91upg
fs92dev
fs92upg
hr92dev
hr92tst'
+ echo list is db12 fs91upg fs92dev fs92upg hr92dev hr92tst
list is db12 fs91upg fs92dev fs92upg hr92dev hr92tst
+ echo

+ echo

+ echo 'INSTANCE_NAME    HTTPS Port  HTTP Port'
INSTANCE_NAME    HTTPS Port  HTTP Port
+ echo '---------------- ---------- ----------'
---------------- ---------- ----------
+ for ORACLE_SID in '$dblist'
+ echo checking for pmon_db12
checking for pmon_db12
+ echo db12
+ od -tx1c
0000000  64  62  31  32  0a
          d   b   1   2  \n
0000005
+ ps -ef
+ grep pmon_db12
+ grep -v grep
+ echo ps command complete
ps command complete
+ ps -ef
+ grep pmon_db12
+ grep -v grep
+ for ORACLE_SID in '$dblist'
+ echo checking for pmon_fs91upg
checking for pmon_fs91upg
+ echo fs91upg
+ od -tx1c
0000000  66  73  39  31  75  70  67  0a
          f   s   9   1   u   p   g  \n
0000010
+ ps -ef
+ grep pmon_fs91upg
+ grep -v grep
+ echo ps command complete
ps command complete
+ ps -ef
+ grep pmon_fs91upg
+ grep -v grep
+ for ORACLE_SID in '$dblist'
+ echo checking for pmon_fs92dev
checking for pmon_fs92dev
+ echo fs92dev
+ od -tx1c
0000000  66  73  39  32  64  65  76  0a
          f   s   9   2   d   e   v  \n
0000010
+ ps -ef
+ grep pmon_fs92dev
+ grep -v grep
+ echo ps command complete
ps command complete
+ ps -ef
+ grep pmon_fs92dev
+ grep -v grep
+ for ORACLE_SID in '$dblist'
+ echo checking for pmon_fs92upg
checking for pmon_fs92upg
+ echo fs92upg
+ od -tx1c
0000000  66  73  39  32  75  70  67  0a
          f   s   9   2   u   p   g  \n
0000010
+ ps -ef
+ grep pmon_fs92upg
+ grep -v grep
+ echo ps command complete
ps command complete
+ ps -ef
+ grep pmon_fs92upg
+ grep -v grep
+ for ORACLE_SID in '$dblist'
+ echo checking for pmon_hr92dev
checking for pmon_hr92dev
+ echo hr92dev
+ od -tx1c
0000000  68  72  39  32  64  65  76  0a
          h   r   9   2   d   e   v  \n
0000010
+ ps -ef
+ grep -v grep
+ grep pmon_hr92dev
+ echo ps command complete
ps command complete
+ ps -ef
+ grep pmon_hr92dev
+ grep -v grep
+ for ORACLE_SID in '$dblist'
+ echo checking for pmon_hr92tst
checking for pmon_hr92tst
+ echo hr92tst
+ od -tx1c
0000000  68  72  39  32  74  73  74  0a
          h   r   9   2   t   s   t  \n
0000010
+ ps -ef
+ grep pmon_hr92tst
+ grep -v grep
+ echo ps command complete
ps command complete
+ ps -ef
+ grep pmon_hr92tst
+ grep -v grep
+ set +xv

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem with if condition

hi, :) pls consider the following if statement if //g') ] then ........ else ....... when i execute the script i am getting the following error '(' unexpected I am not able to find the mistake. could anybody tell where i did mistake. cheers RRK (13 Replies)
Discussion started by: ravi raj kumar
13 Replies

2. Shell Programming and Scripting

problem in if condition

hi, actully i need the belp for the below. host_list=" Host1 host2 host3 host4 " n=`hostname` i need to put the condition like the below if n is among the host mention in the host_list if then #some stugg else # some other stuff fi (1 Reply)
Discussion started by: mail2sant
1 Replies

3. Shell Programming and Scripting

problem in if then else condition

Hi , I am trying the following simple script . But it is always giving 1 output. Dont know why #!/bin/sh find . -name "a.log" if ; then echo "1" else echo "0" fi Kindly advice. it is giving 1 output even when the a.log file is not there (26 Replies)
Discussion started by: himvat
26 Replies

4. Shell Programming and Scripting

Problem in using AND OR condition together

a=rhino b=crocodil c=testsc if && "$c" = testsc ] then echo "Test #5 succeeds." else echo "Test #5 fails." fi i need to test or condition before check the output with AND condition. ur help is much appreciated... (11 Replies)
Discussion started by: gokulraj23
11 Replies

5. Shell Programming and Scripting

if condition not evaluating as expected

Hi all, Thanks in advance for your time. I have a data file like this: 1 7.465753425 2 8.980821918 1 1.717808219 1 6.550684932 0 5.432876712 I wish to write a bash script to check both columns and output a 1 if col1==1 AND col2<3. Otherwise I want to output a 0. In the above... (5 Replies)
Discussion started by: jem8271
5 Replies

6. Shell Programming and Scripting

If condition problem

Hi, I need to use if condition for search a file pattern on a particular location. cd $file_Path if || then do this else do that fi Can someone help me with the if part, how i can put those conditions? make sure format should be *.file* and *.file file is a keyword which i... (5 Replies)
Discussion started by: amit.mathur08
5 Replies

7. Shell Programming and Scripting

problem with if condition

Hi, I'm writing a bash script and i have a condition that goes if then break fi but, when i go to run it, i come across this line 10: ' where line 10 is the if I don't know what's going on :( (2 Replies)
Discussion started by: channyboy
2 Replies

8. Shell Programming and Scripting

Problem in if condition

Hi, below is the script in ksh and i am having issues with if condition. It takes in one argument as input and executes the shell script. The problem is in if condition in shell script. If input is given as 1 it works out well. But if input is given as 2 or something else the script is failing to... (1 Reply)
Discussion started by: abhi_123
1 Replies

9. Shell Programming and Scripting

If condition problem

Hi All, I am using below if condition to check whether null is passed as a parameter to the program if or ; then echo "ABC">>$FILE else echo "CDF">>$FILE fi However it is saying me null=null command not found . Please help me with this (9 Replies)
Discussion started by: Hypesslearner
9 Replies

10. Shell Programming and Scripting

Condition problem

Hi All, Seeking for your assistance on how to condition it correctly. cat file1.txt 290,1663,43,888,0,0.00,86.91,0.00,26.98,0.00 290,1663,52,0,0,0.00,0.00,0.00,0.00,0.00 290,1663,52,888,0,0.00,34.60,0.00,9.00,0.00 1st scenario: if the fourth column contains 888s and 0s it is by... (16 Replies)
Discussion started by: znesotomayor
16 Replies
All times are GMT -4. The time now is 10:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy