Sponsored Content
Top Forums UNIX for Dummies Questions & Answers [Solved] How to calculate in sun bash Post 302714283 by Pieter0815 on Friday 12th of October 2012 02:58:11 AM
Old 10-12-2012
[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 too.
Code:
x= $((y - z))

 echo "$x"
 a=`echo "$x"-10 | bc`
 echo "$a"

And the comparison does not work, I tried -bg with no result too
Code:
 if [ `echo "$a" > 0  | bc` ]
   then sendme /rsi/logs/csc_summary_size_check.log stefan.madre
 fi

Thanks for your help

Moderator's Comments:
Mod Comment Please view this code tag video for how to use code tags when posting code and data.

Last edited by vbe; 10-12-2012 at 05:27 AM.. Reason: code tags..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[SOLVED] how to use my aliases in a bash script

Hi, I confess to be stuck ... as explained here Aliases - Bash Reference Manual I added shopt -s expand_aliasesto my script ... but it didn't work. Later I've read I had to add this at the begning of my my script : . ~/.bash_aliases(of course my aliases are in this file) but again, the... (0 Replies)
Discussion started by: xib.be
0 Replies

2. UNIX for Dummies Questions & Answers

Calculate the day after bash

Hello I would like to help me create a script that: Given a date, more precisely a year, one month and one day. must calculate the day after -Input: Year, Month, Day -Output: Next day the Year-Month-Day thanks (9 Replies)
Discussion started by: karkov
9 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

Calculate the number of days between 2 dates - bash script

I wrote the day calculator also in bash. I would like to now, that is it good so? #!/bin/bash datum1=`date -d "1991/1/1" "+%s"` datum2=`date "+%s"` diff=$(($datum2-$datum1)) days=$(($diff/(60*60*24))) echo $days Thanks in advance for your help! (3 Replies)
Discussion started by: kovacsakos
3 Replies

5. UNIX for Dummies Questions & Answers

[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... (12 Replies)
Discussion started by: Pieter0815
12 Replies

6. 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

7. Shell Programming and Scripting

[Solved] If statement in bash

I have the following code in bash, however "set red frmt" is not displayed. echo "iarg_rd = $iarg_rd" iarg_rd="2" if ; then echo "Hello World" fi if ; then frmt="${gap}${!frmt_titl_yl}" elif ; then frmt="${gap}${!frmt_titl_bk}" elif ; then echo... (2 Replies)
Discussion started by: kristinu
2 Replies

8. Shell Programming and Scripting

[Solved] Using awk to calculate max value

I have a file of sites and each site has a variable number of flow values with a date for each value. I want to determine the max value of flow for each site and output the site number, max value, and date of max value.The format structure (simplified) is the following: Record Site Number ... (5 Replies)
Discussion started by: cparr
5 Replies

9. Shell Programming and Scripting

Bash cript to calculate summarize address

Hi, I need to write a bash script that when i enter two ip address, it will calculate summerize address for them. Examlpe: 192.168.1.27/25 192.168.1.129/25 Result will be: 192.168.1.0/24 can you help me with this script? I even dont know how to start with it (3 Replies)
Discussion started by: Miron
3 Replies

10. Shell Programming and Scripting

Bash to calculate average of all files in directory and output by part of filename

I am trying to use awk to calculate the average of all lines in $2 for every file in a directory. The below bash seems to do that, but I cannot figure out how to capture the string before the _ as the output file name and have it be tab-delimeted. Thank you :). Filenames in... (3 Replies)
Discussion started by: cmccabe
3 Replies
DISKPART(8)						      System Manager's Manual						       DISKPART(8)

NAME
diskpart - calculate default disk partition sizes SYNOPSIS
/usr/sbin/diskpart [ -p ] [ -d ] disk-type DESCRIPTION
Diskpart is used to calculate the disk partition sizes based on the default rules used at Berkeley. If the -p option is supplied, tables suitable for inclusion in a device driver are produced. If the -d option is supplied, an entry suitable for inclusion in the disk descrip- tion file /etc/disktab is generated; c.f. disktab(5). On disks that use bad144-style bad-sector forwarding, space is left in the last partition on the disk for a bad sector forwarding table. The space reserved is one track for the replicated copies of the table and suffi- cient tracks to hold a pool of 126 sectors to which bad sectors are mapped. For more information, see bad144(8). The disk partition sizes are based on the total amount of space on the disk as given in the table below (all values are supplied in units of 512 byte sectors). The `c' partition is, by convention, used to access the entire physical disk. The device driver tables include the space reserved for the bad sector forwarding table in the `c' partition; those used in the disktab and default formats exclude reserved tracks. In normal operation, either the `g' partition is used, or the `d', `e', and `f' partitions are used. The `g' and `f' partitions are variable-sized, occupying whatever space remains after allocation of the fixed sized partitions. If the disk is smaller than 20 Megabytes, then diskpart aborts with the message ``disk too small, calculate by hand''. Partition 20-60 MB 61-205 MB 206-355 MB 356+ MB a 15884 15884 15884 15884 b 10032 33440 33440 66880 d 15884 15884 15884 15884 e unused 55936 55936 307200 h unused unused 291346 291346 If an unknown disk type is specified, diskpart will prompt for the required disk geometry information. SEE ALSO
disktab(5), bad144(8) BUGS
Certain default partition sizes are based on historical artifacts (e.g. RP06), and may result in unsatisfactory layouts. When using the -d flag, alternate disk names are not included in the output. 4th Berkeley Distribution November 17, 1996 DISKPART(8)
All times are GMT -4. The time now is 08:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy