[Solved] Calculation on sun again


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers [Solved] Calculation on sun again
# 8  
Old 11-22-2012
You seem to be mixing up old and modern bash or ksh93 scripting integer syntax. I suggest you stick to modern syntax. Also make sure that you have a appropriate shebang as the first line of your script.

Code:
$ a=0
$ b=40000
$ c=10000
$ a=$(( b - c ))
$ echo $a
30000
$ d=$(( a - 10000 ))
$ echo $d
20000
$ d=$(( a - 50000 ))
$ echo $d
-20000
$ if (( d > 0 ))
> then
> echo "greater"
> fi
$

# 9  
Old 11-22-2012
I use the bash shell.

I changed the code as suggested:


Code:
   1  #!/usr/bin/bash
   2  #Berechnung und Warnung bei Vergroesserung der rsi und scr Daten um 100GB
   3
   4  SIZE_RSI=`grep ^rsi /rsi/logs/csc_summary_size_check.log | tail -1 | cut -d";" -f4 | cut -b1-4`
   5  SIZE_SCR=`grep ^scr /rsi/logs/csc_summary_size_check.log | tail -1 | cut -d";" -f4 | cut -b1-4`
   6  b=$SIZE_RSI
   7  y=$SIZE_SCR
   8  echo "$b"
   9  echo "$y"
  10
  11  SIZE_VORHER_RSI=`grep ^rsi /rsi/logs/csc_summary_size_check.log | tail -2 | cut -d";" -f4 | cut -b1-4`
  12  SIZE_VORHER_SCR=`grep ^scr /rsi/logs/csc_summary_size_check.log | tail -2 | cut -d";" -f4 | cut -b1-4`
  13  c=$SIZE_VORHER_RSI
  14  z=$SIZE_VORHER_SCR
  15  echo "$c"
  16  echo "$z"
  17
  18  let a=0
  19  a=$(( b - c ))
  20  echo "$a"
  21  d=$(( a - 1000 ))
  22  echo "$d"
  23  if [ "$d" -gt "0" ] ; then
  24   sendme /rsi/logs/csc_summary_size_check.log stefan
  25  fi
  26
  27  let x=0
  28  a=$(( y - z ))
  29  echo "$x"
  30  w=$(( x - 1000 ))
  31  echo "$w"
  32  if [ "$w" -gt "0" ] ; then
  33   sendme /rsi/logs/csc_summary_size_check.log stefan
  34  fi
  35

and the messages after starting are:


sum result is:
3927 is OK
1479 is OK
3927 is OK
3927 don't know why this is shown here
1471 is OK
1479 don't know why this is shown here
/rsi/utils/csc_size_check: line 19: 3927
3927: syntax error in expression (error token is "3927")
0 is logic
-1000 is logic
/rsi/utils/csc_size_check: line 28: 1471
1479: syntax error in expression (error token is "1479")
0 is logic
-1000 is logic

Out of some reason he do not know the numbers as what they are. This is confusing. And to all who help me a gret thank you.

Last edited by vgersh99; 11-22-2012 at 10:55 AM.. Reason: fixed code tags
# 10  
Old 11-22-2012
change if [ "$d" -gt "0" ] ; then to if [ "$d" -gt 0 ] ; then - loose the double-quotes.
Do the same to the other 'if'
# 11  
Old 11-22-2012
Done, no change with the Error messages.
Code:
3927
1479
3927
3927
1471
1479
/rsi/utils/csc_size_check: line 19: 3927
3927: syntax error in expression (error token is "3927")
0
-1000
/rsi/utils/csc_size_check: line 28: 1471
1479: syntax error in expression (error token is "1479")
0
-1000

# 12  
Old 11-22-2012
Modify lines 11 and 12 like this:
Code:
  11  SIZE_VORHER_RSI=`grep ^rsi /rsi/logs/csc_summary_size_check.log | tail -2 | cut -d";" -f4 | cut -b1-4 | head -1`
  12  SIZE_VORHER_SCR=`grep ^scr /rsi/logs/csc_summary_size_check.log | tail -2 | cut -d";" -f4 | cut -b1-4 | head -1`

I would use awk but without knowing what is in your log files, it's hard to suggest anything.
This User Gave Thanks to jlliagre For This Post:
# 13  
Old 11-23-2012
Now it works , thank you to all who helped me.
 
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