The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
error in ksh script G.K.K Shell Programming and Scripting 5 10-15-2008 10:49 AM
when executing .sh script in telnet error "script not found" smiley Shell Programming and Scripting 1 04-22-2008 02:01 PM
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 11:16 AM
Script Error if ... then Nysif Steve UNIX for Dummies Questions & Answers 4 09-19-2007 04:41 PM
error in awk script rraajjiibb Shell Programming and Scripting 7 06-10-2004 08:37 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-10-2009
amitranjansahu's Avatar
amitranjansahu amitranjansahu is offline
Registered User
  
 

Join Date: Jan 2009
Location: Gurgaon,INDIA
Posts: 239
error in script

i am using a shell script where i have to start 20 applications

for (( i = 1 ; i <= 20 ; i++ ))
do
export SMCHOME=/global/app/R1S1A3/RAFS/RAF_$i
$SMCHOME/bin/genraf.exe &> LOG_RAF/RAF_$i.txt &
done

But only the first instance is started and rest are not .
  #2 (permalink)  
Old 02-10-2009
sunpraveen's Avatar
sunpraveen sunpraveen is offline
Registered User
  
 

Join Date: Jan 2009
Location: Pruthvi
Posts: 85
That is because of the missing statement (highlighted in RED) within the for loop

Code:
for (( i = 1 ; i <= 20 ; i++ ))
do
export SMCHOME=/global/app/R1S1A3/RAFS/RAF_$i
$SMCHOME/bin/genraf.exe &> LOG_RAF/RAF_$i.txt &
i= $(( $i + 1 ))
done
HTH,

Regards,

Praveen
  #3 (permalink)  
Old 02-10-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,866
Quote:
Originally Posted by sunpraveen View Post
That is because of the missing statement (highlighted in RED) within the for loop

Code:
for (( i = 1 ; i <= 20 ; i++ ))
do
export SMCHOME=/global/app/R1S1A3/RAFS/RAF_$i
$SMCHOME/bin/genraf.exe &> LOG_RAF/RAF_$i.txt &
i= $(( $i + 1 ))
done
No, that's taken care of by the for loop (otherwise there would be a syntax error). I suspect the shell parses the redirection incorrectly. Try writing it like this:
Code:
for (( i = 1 ; i <= 20 ; i++ ))
do
    export SMCHOME=/global/app/R1S1A3/RAFS/RAF_$i
    ${SMCHOME}/bin/genraf.exe > LOG_RAF/RAF_${i}.txt &
done
  #4 (permalink)  
Old 02-10-2009
amitranjansahu's Avatar
amitranjansahu amitranjansahu is offline
Registered User
  
 

Join Date: Jan 2009
Location: Gurgaon,INDIA
Posts: 239
Thanks a lot its working now
  #5 (permalink)  
Old 02-10-2009
sunpraveen's Avatar
sunpraveen sunpraveen is offline
Registered User
  
 

Join Date: Jan 2009
Location: Pruthvi
Posts: 85
Pludi,

Quote:
No, that's taken care of by the for loop (otherwise there would be a syntax error). I suspect the shell parses the redirection incorrectly. Try writing it like this:
Thanks for pointing that out! A gaffe, if ever there was one!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:38 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0