User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,419 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,648 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 3103 | Replies: 4
Reply
Join Date: Jan 2007
Posts: 3
Reputation: lastkey is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
lastkey lastkey is offline Offline
Newbie Poster

Help two variable sin single loop

  #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!!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2004
Posts: 177
Reputation: jim mcnamara is on a distinguished road 
Rep Power: 5
Solved Threads: 9
jim mcnamara jim mcnamara is offline Offline
Junior Poster

Re: two variable sin single loop

  #2  
Jan 4th, 2007
for i in vs01a vs01b 
do
	for k in 1 2 
	do
		rsh $i echo $(tail -20 /opt/oracle/admin/+ASM/bdump/alert_+ASM"$k".log) >> VS_logs.txt
    done
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  
Join Date: Jan 2007
Posts: 3
Reputation: lastkey is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
lastkey lastkey is offline Offline
Newbie Poster

Re: two variable sin single loop

  #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  
Join Date: May 2004
Posts: 177
Reputation: jim mcnamara is on a distinguished road 
Rep Power: 5
Solved Threads: 9
jim mcnamara jim mcnamara is offline Offline
Junior Poster

Re: two variable sin single loop

  #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  
Join Date: Jan 2007
Posts: 3
Reputation: lastkey is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
lastkey lastkey is offline Offline
Newbie Poster

Re: two variable sin single loop

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 12:59 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC