9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have the following code snippet in bash
if ]; then
minm=`echo "$diff" | bc`
fi
It works well for most of the cases. However lets say diff is -0.17 and minm is -0.0017. In such a case the comparison seems to fail. Is the correct way to compare a mixture of positive and... (12 Replies)
Discussion started by: ngabrani
12 Replies
2. Shell Programming and Scripting
Hi, I need to run a Fortran program which reads a input file with a fixed name many times, each time I need to change a number (real) in that input file, this is how I currently do it and I know it is not elegent at all:
cp inputfile.dat backup.dat
sed -i 's/28.0/0.01/g' inputfile.dat
./myCode... (3 Replies)
Discussion started by: dypang
3 Replies
3. Shell Programming and Scripting
Hi people :)
I'm learning shell scripting using bash and I want to generate 4 floating point number with 5 decimal places and write them to a file and a variable. I've done all this except the $RAMDOM enviroment variable does not generate a float number but a integrer.
I hope you could... (3 Replies)
Discussion started by: pharaoh
3 Replies
4. Shell Programming and Scripting
Hi ,
I'm trying to compare fields in the file, I want compare the numbers in each column and get the least value of it.
> cat input_file
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
-0.2050 -0.6629 -0.6407 -0.6599
-0.4085 -0.3959 -0.2526 -0.3597
0.3439 0.2275 0.2780 ... (5 Replies)
Discussion started by: novice_man
5 Replies
5. Solaris
Hi all,
I have doubt can array in a shell script can store floating point numbers. i have tired. but i unable to work it out.
Please help me regarding this
Thank U
Naree (1 Reply)
Discussion started by: naree
1 Replies
6. Solaris
total=0
declare -a sum
limit=`iostat -En | grep -i size | awk '{print $2}' | sed -e 's/GB//g' | wc -l`
echo "Limit is equal to $limit"
ara="`iostat -En | grep -i size | awk '{print $2}' | sed -e 's/GB//g'`"
for (( i=1; i<=$limit; i++ ))
do
sum=`echo $ara | cut -d " " -f $i`
echo ${sum}... (11 Replies)
Discussion started by: naree
11 Replies
7. UNIX for Advanced & Expert Users
$name = 'Mark';
$goodguy = 'Tody';
if ($name == $goodguy) {
print "Hello, Sir.\n";
} else {
print "Begone, evil peon!\n";
}
The output is Hello, Sir......
Even if the Mark is made to MarkSpencer.....then also it shows as Hello, Sir....
Can any one explain the... (7 Replies)
Discussion started by: bishweshwar
7 Replies
8. Shell Programming and Scripting
I had a variable 1:80 8 in one varialbe say var=1:80 8
i comapred the below
if
then
--
else
----
thought if condition is true its always going in the else condition....its not giving any compilation errror also....is there any problem bcoz of space...
can some one help... (3 Replies)
Discussion started by: mkan
3 Replies
9. Shell Programming and Scripting
how to add 2 float values to each other?
i tried this and it doesnt work:
#!bin/bash
numone=1.234
numtwo=0.124
total=`expr $numone + $numtwo`
echo $total
thanks (5 Replies)
Discussion started by: strike
5 Replies