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




Thread: error in script
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 02-10-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,876
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