[Solved] Calculation on sun again


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers [Solved] Calculation on sun again
# 1  
Old 11-21-2012
[Solved] Calculation on sun again

I posted this question before 2 months and gain a solution. Thanks again for this, but I tried it now and had no success. Could the specialists be so kind to have a second look please.


Please look down to see the whole code.


All 3 shown calculation possibilities have the same result that the subtraction is not done. Dosen't matter if there is the line 13 or not. The result is always -100000.
The numbers are not greater than 400000.
Thanks for your help in advance.
Pieter

Last edited by Pieter0815; 11-21-2012 at 12:42 PM..
# 2  
Old 11-21-2012
That is what I get when b and c are not defined.

Show your whole code please.
# 3  
Old 11-21-2012
Code:
SIZE_RSI=`grep ^rsi /rsi/logs/csc_summary_size_check.log | tail -1 | cut -d";" -f4 | cut -b1-6`
SIZE_SCR=`grep ^scr /rsi/logs/csc_summary_size_check.log | tail -1 | cut -d";" -f4 | cut -b1-6`
b=$SIZE_RSI
y=$SIZE_SCR
   
SIZE_VORHER_RSI=`grep ^rsi /rsi/logs/csc_summary_size_check.log | tail -2 | cut -d";" -f4 | cut -b1-6`
SIZE_VORHER_SCR=`grep ^scr /rsi/logs/csc_summary_size_check.log | tail -2 | cut -d";" -f4 | cut -b1-6`
c=$SIZE_VORHER_RSI
z=$SIZE_VORHER_SCR

a=0
((a=b\-c))
#a=$(echo "$b-$c"|bc)
#a="$(($b-$c))"
d="$(($a-100000))"
  
if [ "$d" -gt "0" ] ; then
sendme /rsi/logs/csc_summary_size_check.log stefan
fi

x=0
((x=y-z))
#   x="$(($y-$z))"
w="$(($x-100000))"

if [ "$w" -gt "0" ] ; then
sendme /rsi/logs/csc_summary_size_check.log stefan
fi

the first variables b,c,y and z are OK. I checked them with echo.

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by Pieter0815; 11-22-2012 at 05:53 AM..
# 4  
Old 11-21-2012
Post in code tags and without line numbers.

Make sure your variables don't have spaces in them by doing echo "'$a'"
# 5  
Old 11-21-2012
This requires the KSH shell, make sure you're using it.

Also: ((a=b\-c)) Leave the \ out.
# 6  
Old 11-22-2012
Thanks, but I tried this some lines down
Code:
((x=y-z))

and this does not work too.
# 7  
Old 11-22-2012
Ok
Code:
if [ $d -gt 0 ] ; #the fact that you are using greater than means you are comparing Integers  "" is confusing...

instead of
Code:
 a=0

use
Code:
 let a=0

now its a numeric value...

As mentionned what shell are you using?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Hardware

[solved] Sun Netra X1 - Adding a Second Hard Drive

As the title suggests, I'm trying to install a second drive (really want an OS mirror) on a Sun Netra X1. I've taken the spacer out, and had a go at with the drill-press so now I have a nice HDD tray. Have installed an IDE drive in the tray, plugged in the power and data cables that were... (0 Replies)
Discussion started by: Smiling Dragon
0 Replies

2. UNIX for Dummies Questions & Answers

[Solved] How to calculate in sun bash

I have two problems, and it would be great if someone could help me: The first line does not calculate. I have checked the origin term to calculate the variables and the result is OK. Normal substactions with $xx -100 work, but not in this constallation. I tried it with "| bc" and no result... (2 Replies)
Discussion started by: Pieter0815
2 Replies

3. Emergency UNIX and Linux Support

[Solved] DCMU (disk control and monitor utility) sun fire

Hi , during 2 weeks i´ve been trying to find them. i need DCMU packets for managing internal disks on sun fire x4500 and sun fire x4600 on rhel. i have opened to tickets to myoraclesupport but no answer. please anybody could tell me a link or anythiing?? i´ve been searching and searching... (1 Reply)
Discussion started by: pabloli150
1 Replies

4. Shell Programming and Scripting

[solved] merging two files and writing to another file- solved

i have two files as file1: 1 2 3 file2: a b c and the output should be: file3: 1~a 2~b 3~c (1 Reply)
Discussion started by: mlpathir
1 Replies

5. Solaris

Sun Fire 280R Sun Solaris CRT/Monitor requirements

I am new to Sun. I brought Sun Fire 280R to practice UNIX. What are the requirements for the monitor/CRT? Will it burn out old non-Sun CRTs? Does it need LCD monitor? Thanks. (3 Replies)
Discussion started by: bramptonmt
3 Replies

6. UNIX for Dummies Questions & Answers

Sun Solaris 10: How do I create a bootup disc? The Sun website confuses me

Hey there, I am starting a Computer Science Foundation year at the end of this month and am trying to get a little bit ahead of the game. I have always wanted to learn Unix and am currently struggling with creating a boot disc to run Solaris (I have chosen to study this) from as opposed to... (0 Replies)
Discussion started by: Jupiter
0 Replies

7. UNIX for Advanced & Expert Users

Help: Sun Disk partitioning for Sun V240 & StorEdge 3300

Dear Sun gurus, I have Sun Fire V240 server with its StorEdge 3300 disk-array. Following are its disks appeared in format command. I have prepared its partitions thru format and metainit & metattach (may be i have made wrong steps, causing the errors below because I have done thru some document... (1 Reply)
Discussion started by: shafeeq
1 Replies
Login or Register to Ask a Question