We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,555 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

problem with evaluating expression in shell script

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

2
Contributors
1
Reply
53 Minutes
Discussion Span
1 Year Ago
Last Updated
2
Views
vip011
Newbie Poster
1 post since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
cfajohnson
Junior Poster
196 posts since Dec 2008
Reputation Points: 25
Solved Threads: 23
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0549 seconds using 2.66MB