1,105,416 Community Members

problem with evaluating expression in shell script

Member Avatar
vip011
Newbie Poster
1 post since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

HI EVERYONE

I would be grateful if someone could help me solving the problem with my CSH file.

I am running a simulation which runs with the qsub line in the CSH file and is followed by number of parameter which is required to run the program.

But before this i use while loop to create 150 files. In the example i use calculate the parameter $field with the help of the loop and use it in my simulation and this works. However when i try to calculate parameter ${rh} it does not work and the program goes into an infinite loop. basically i wish to calculate (1/field) and use it as an input parameter in the running the simulation

Thanks a lot.

Any help is greatly appreciated. maybe its a very stupid question for regulars of C++ but i dont get it as i am only 1 days old in the world of C++.

#!/bin/csh

@ number = 1
while ( $number < 151)
if( $number < 10 ) then
set filename = b00$number
else
if( $number < 100 ) then
set filename = b0$number
else
set filename = b$number
endif
endif

@ field = $number * 2000
@ rh = 1 / $field

qsub -l arch=sol-amd64 -cwd -N ${filename} -o ${filename}.log -j y << EOF
./rose bose \
0 1200 0 0 0 \
0 30000 0 109.5 0 \
0 20000 0 -35.0 0 \
0 0 0 0 0 0 \
0 0 0 0 0 0 \
0 0 0 0 0 0 \
3 120 0 ${field} 50000 25e-6 ${rh} 5 120 512 0 $filename
EOF

@ number += 1
end

Member Avatar
cfajohnson
Junior Poster
199 posts since Dec 2008
Reputation Points: 10 [?]
Q&As Helped to Solve: 24 [?]
Skill Endorsements: 0 [?]
 
0
 
You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article