Sponsored Content
Top Forums UNIX for Dummies Questions & Answers (+ sign) Unexpected arithmetic expr script interpretation Post 302089678 by Glenn Arndt on Wednesday 20th of September 2006 10:40:55 AM
Old 09-20-2006
An explanation of the dot is here: https://www.unix.com/aix/31018-pb-script-execution-variables.html

I believe gkrishnag meant ${num1} not {$num2}.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sign on/Sign off logging script

I'd like to make a script that I can execute every time I sign on to my linux box that keeps track of the time and allows to me to add a remark to a file. So basically once I log in, I run the script, and it outputs the date and time to a text file (log.txt). But that isn't my problem. I need... (1 Reply)
Discussion started by: Glider
1 Replies

2. UNIX for Dummies Questions & Answers

problem in script involving month arithmetic

advance happy new year to all, i am having a script.The purpose of the scripts is as follows.If the current month is march,june,september or december ,inc_flg should be set to '1' otherwise inc_flg should be set to '2' month= date +"%m" if || || || ; then inc_flg = 1 else ... (6 Replies)
Discussion started by: rajarp
6 Replies

3. Shell Programming and Scripting

help with expr command in script

Hi, I am trying to code a unix function to calculate date difference between two date variables. I am stuck at a point where I am trying to convert hours into minutes. Below is the code I am doing. function get_elapsed_time { export PROPS_FILE=temp.properties export... (8 Replies)
Discussion started by: Nutan
8 Replies

4. Shell Programming and Scripting

Arithmetic Problem with shell script programming.

Hello everybody, I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input. I... (1 Reply)
Discussion started by: Florinel76
1 Replies

5. Homework & Coursework Questions

Arithmetic Problem with shell script programming.

Hello everybody, I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input. I... (8 Replies)
Discussion started by: Florinel76
8 Replies

6. Shell Programming and Scripting

Interpretation of $variables inside programs run from a script

Hi, I am running a shell script that executes a program. Inside this program, variables are also referenced using a dollar symbol, eg. $a, $thething, and the shell script is misinterpreting them as variables relevant to the shell script rather than relevant to the program run from inside the... (2 Replies)
Discussion started by: TheBigH
2 Replies

7. Shell Programming and Scripting

SSH Script is sticking, & sign not doing what I would expect

I am having an issue where I am do an SSH to about 30 servers one at a time however my script is getting hung up sometimes on the SSH. I thought the & at the end as seen below would fire it and move on but that does not seem to be working. #!/bin/s for remsys in trumpetsnail angel delphin... (3 Replies)
Discussion started by: LRoberts
3 Replies

8. Shell Programming and Scripting

Script to replace last instance of . between two consecutive = sign by ,

Suppose you have a line like this: cn=user.blr.ou=blr.india.o=company The line should be converted like this: cn=user.blr,ou=blr.india,o=comapny Was wondering how to do that using shell script. Please use tags where appropriate, thank you (4 Replies)
Discussion started by: saurabhkoar
4 Replies

9. Shell Programming and Scripting

how to do decimal arithmetic in shell script

hi, I have a file with decimal/non-decimal values $ cat b22 373 164 92 62 20 131 94 12 129 111 95 154 37 15 447 25 7.4 135 77 122 32 92 70 57 37 42 72 17 13 97 40 41 53 22 80 71 29 87 23 31 273 6.2 12K 43 44 45 22 11 7.7 13 18 173 36 20 18 13 56 67 104 53 5.4 241 19 13 3.8 38 14 31 329 16 155... (8 Replies)
Discussion started by: sam05121988
8 Replies

10. Shell Programming and Scripting

Help with Arithmetic calculations in Shell script

Hi, I need a help with arithmetic calculations in my script. I have two variables: a=17; b=1712 I want to perform ($a/$b)*100 with two decimals in the result. I tried with following: res=$((100*a/b)) res=`echo "scale=2; $a / $b" | bc` But I am not getting the decimal values.... (4 Replies)
Discussion started by: karumudi7
4 Replies
PROP_NUMBER(3)						   BSD Library Functions Manual 					    PROP_NUMBER(3)

NAME
prop_number, prop_number_create_integer, prop_number_create_unsigned_integer, prop_number_copy, prop_number_size, prop_number_unsigned, prop_number_integer_value, prop_number_unsigned_integer_value, prop_number_equals, prop_number_equals_integer, prop_number_equals_unsigned_integer -- numeric value property object LIBRARY
Property Container Object Library (libprop, -lprop) SYNOPSIS
#include <prop/proplib.h> prop_number_t prop_number_create_integer(int64_t val); prop_number_t prop_number_create_unsigned_integer(uint64_t val); prop_number_t prop_number_copy(prop_number_t number); int prop_number_size(prop_number_t number); bool prop_number_unsigned(prop_number_t number); int64_t prop_number_integer_value(prop_number_t number); uint64_t prop_number_unsigned_integer_value(prop_number_t number); bool prop_number_equals(prop_number_t num1, prop_number_t num2); bool prop_number_equals_integer(prop_number_t number, int64_t val); bool prop_number_equals_unsigned_integer(prop_number_t number, uint64_t val); DESCRIPTION
The prop_number family of functions operate on a numeric value property object type. Values are either signed or unsigned, and promoted to a 64-bit type (int64_t or uint64_t, respectively). It is possible to compare number objects that differ in sign. Such comparisons first test to see if each object is within the valid number range of the other: o Signed numbers that are greater than or equal to 0 can be compared to unsigned numbers. o Unsigned numbers that are less than or equal to the largest signed 64-bit value (INT64_MAX) can be compared to signed numbers. Number objects have a different externalized representation depending on their sign: o Signed numbers are externalized in base-10 (decimal). o Unsigned numbers are externalized in base-16 (hexadecimal). When numbers are internalized, the sign of the resulting number object (and thus its valid range) is determined by a set of rules evaluated in the following order: o If the first character of the number is a '-' then the number is signed. o If the first two characters of the number are '0x' then the number is unsigned. o If the number value fits into the range of a signed number then the number is signed. o In all other cases, the number is unsigned. prop_number_create_integer(int64_t val) Create a numeric value object with the signed value val. Returns NULL on failure. prop_number_create_unsigned_integer(uint64_t val) Create a numeric value object with the unsigned value val. Returns NULL on failure. prop_number_copy(prop_number_t number) Copy a numeric value object. If the supplied object isn't a numeric value, NULL is returned. prop_number_size(prop_number_t number) Returns 8, 16, 32, or 64, representing the number of bits required to hold the value of the object. If the supplied object isn't a numeric value, NULL is returned. prop_number_unsigned(prop_number_t number) Returns true if the numeric value object has an unsigned value. prop_number_integer_value(prop_number_t number) Returns the signed integer value of the numeric value object. If the supplied object isn't a numeric value, zero is returned. Thus, it is not possible to distinguish between ``not a prop_number_t'' and ``prop_number_t has a value of 0''. prop_number_unsigned_integer_value(prop_number_t number) Returns the unsigned integer value of the numeric value object. If the supplied object isn't a numeric value, zero is returned. Thus, it is not possible to distinguish between ``not a prop_number_t'' and ``prop_number_t has a value of 0''. prop_number_equals(prop_number_t num1, prop_number_t num2) Returns true if the two numeric value objects are equivalent. If at least one of the supplied objects isn't a numeric value, false is returned. prop_number_equals_integer(prop_number_t number, int64_t val) Returns true if the object's value is equivalent to the signed value val. If the supplied object isn't a numerical value or if val exceeds INT64_MAX, false is returned. prop_number_equals_unsigned_integer(prop_number_t number, uint64_t val) Returns true if the object's value is equivalent to the unsigned value val. If the supplied object isn't a numerical value or if val exceeds INT64_MAX, false is returned. SEE ALSO
prop_array(3), prop_bool(3), prop_data(3), prop_dictionary(3), prop_object(3), prop_string(3), proplib(3) HISTORY
The proplib property container object library first appeared in NetBSD 4.0. BSD
January 21, 2008 BSD
All times are GMT -4. The time now is 05:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy