two variable sin single loop

Reply

Join Date: Jan 2007
Posts: 3
Reputation: lastkey is an unknown quantity at this point 
Solved Threads: 0
lastkey lastkey is offline Offline
Newbie Poster

two variable sin single loop

 
0
  #1
Jan 3rd, 2007
Hi,

I wan tto use 2 variables at same time in single loop. Like

for i in vs01a vs01b for k in 1 2
do
rsh $i echo 'tail -20 /opt/oracle/admin/+ASM/bdump/alert_+ASM$k.log' >> VS_logs.txt


how to do it. because for vso1a it's ASM1.log whereas for vs01b it's ASM2.log.

help me!!
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 178
Reputation: jim mcnamara is on a distinguished road 
Solved Threads: 10
jim mcnamara jim mcnamara is offline Offline
Junior Poster

Re: two variable sin single loop

 
0
  #2
Jan 4th, 2007
Shell Scripting Syntax (Toggle Plain Text)
  1. for i in vs01a vs01b
  2. do
  3. for k in 1 2
  4. do
  5. rsh $i echo $(tail -20 /opt/oracle/admin/+ASM/bdump/alert_+ASM"$k".log) >> VS_logs.txt
  6. done
  7. done

For "rsh" do you mean rexec or remsh? Or does rsh create a remote shell on remote systems using your OS?
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3
Reputation: lastkey is an unknown quantity at this point 
Solved Threads: 0
lastkey lastkey is offline Offline
Newbie Poster

Re: two variable sin single loop

 
0
  #3
Jan 5th, 2007
rsh means remote shell. We use this method to access our remote systems. you applied two loops in the solution. But I've said ASM1.log file is on VS01a but not on VS01b, and ASM2.log is on VS01b not on VS01a. so it will give error when executed.
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 178
Reputation: jim mcnamara is on a distinguished road 
Solved Threads: 10
jim mcnamara jim mcnamara is offline Offline
Junior Poster

Re: two variable sin single loop

 
0
  #4
Jan 5th, 2007
Originally Posted by lastkey View Post
rsh means remote shell. We use this method to access our remote systems. you applied two loops in the solution. But I've said ASM1.log file is on VS01a but not on VS01b, and ASM2.log is on VS01b not on VS01a. so it will give error when executed.
Why loop? you only need two rsh lines. You gain nothing by looping.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3
Reputation: lastkey is an unknown quantity at this point 
Solved Threads: 0
lastkey lastkey is offline Offline
Newbie Poster

Re: two variable sin single loop

 
0
  #5
Jan 5th, 2007
Originally Posted by jim mcnamara View Post
Why loop? you only need two rsh lines. You gain nothing by looping.
:cheesy: lol. Why!!!! That's what I did wrote straight two lines. But is there any harm to know the alternative way
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC