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!!

Recommended Answers

All 4 Replies

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?

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.

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.

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.