The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
while loop inside while loop panknil Shell Programming and Scripting 0 01-07-2008 09:49 AM
For loop xramm HP-UX 3 10-10-2007 11:20 AM
While Loop hemangjani Shell Programming and Scripting 2 11-02-2006 08:01 AM
for loop munnabhai1 Shell Programming and Scripting 3 04-06-2006 11:30 AM
how to get the similar function in while loop or for loop trynew Shell Programming and Scripting 3 06-17-2002 08:09 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-15-2005
Registered User
 

Join Date: Sep 2005
Posts: 3
rsh and for loop

hi
I wanted to use the for loop structure in tandem with rsh command and the result to be redirected into a local .lst file within a shell script .
Tried the following but does not help .

rsh ABCD "cd /bosp/local/home/linus/;for i in `ls -ltr | grep ^- | awk {'print $9'}`
do
echo service:`pwd` /`sum $i | awk {'print $3 ":" $1'}``ls -ltr $i | awk {'print ":"$1'}`
done">>/bosp/local/home/linus/result/cde.lst;



Thanx in advance
newbee2005
Reply With Quote
Forum Sponsor
  #2  
Old 09-15-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
That super complex compound command is delimited by double quotes. But it also has double quotes internally. That is not gonna work.
Reply With Quote
  #3  
Old 09-16-2005
Registered User
 

Join Date: Sep 2005
Posts: 3
Thanx
u are rite, i had to seperate the commands as
-those in the For condition
-those inside the do loop
by seperate sets of double quotes ...
but another issue that i didnt face before is that
the commands within the do loop again have to be individually seperatd by semi colons , but that causes the result to be displayed on seperate lines , whereas i want the result of one loop to be on the same line ,
can anyone help with that ...

"echo service:`pwd` /;"sum $i | awk {'print $3 ":" $1'}";"ls -ltr $i | awk {'print ":"$1'}""


newbee2005
Reply With Quote
  #4  
Old 09-16-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
You should make your complex compound command into a shell script. And then just run that script.
Reply With Quote
  #5  
Old 09-16-2005
Registered User
 

Join Date: Sep 2005
Posts: 3
This piece of command is actually a shell script .
There is a second shell script which depends on this script .
I was trying to eliminate the need for having 2 different scripts by including one in the other thats when the problem ....

so having this as a script is not possible
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:48 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0