Sponsored Content
Full Discussion: test command is not working
Top Forums Shell Programming and Scripting test command is not working Post 302078736 by thestevew on Tuesday 4th of July 2006 09:09:40 AM
Old 07-04-2006
Looks like integer overflow in the test. I get the same result on SunOS 5.6 but ksh on Aix 5.3 gives the right answer.

You could use bc to get round it, just test for a negative result after subtracting limit from size

Code:
size=3978132853
limit=100 
typeset -L1 res
res=$(($size - $limit))
if [ ! "$res" = "-" ]; then
  print exceeded limit
fi

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

the TEST command

Hi everyone, I am new to UNIX and scripting, and I have some problems with the test command. when i try to execute the command: test 20070327.gz > 20070320.gz i try to make a charachter string comparison between the two strings or the two files, to make sure that 20070327.gz is greater than... (2 Replies)
Discussion started by: marwan
2 Replies

2. Shell Programming and Scripting

TEST command

I have been looking into searching various files to display output. The search criteria will be a month and year to output various numbers in the files. is there any way to do this with the TEST function or would it have to be another way? (4 Replies)
Discussion started by: amatuer_lee_3
4 Replies

3. Solaris

How i test the UDP port is working?

Hi anybody know how to test out the UDP port working? cos UDP cannot use telnet to test... Sumemr (2 Replies)
Discussion started by: summerpeh
2 Replies

4. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

5. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

6. UNIX for Advanced & Expert Users

if and test not working

All, I am getting error when run file check with test operator . Why is it showing the error if then echo 'file found' fi ksh: -r: unknown test operator I know i can use the below code to test the file but why the above is not working if test -r filename ... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

7. Shell Programming and Scripting

String == isn't working in [[-test

Hi. I'm new to this forum, my English perhaps is not so good, but here is my question: In bash you can use ] for tests, and how I understand it the variable names should be expanded automatically. So this should give "yes": xx=hello $ ] && echo yes || echo no no # not giving "yes" These two... (2 Replies)
Discussion started by: 244an
2 Replies

8. Shell Programming and Scripting

Use The Terminal To Test Arduino Is Working.

Hi all... (Apologies for any typos at all.) This is a step by step _script_ to check if your Arduino is talking to your Linux or Macbook Pro computer using the Terminal... It works on at least 3 Linux flavours and now the Macbook Pro... I hope you find it useful as a simple check for... (0 Replies)
Discussion started by: wisecracker
0 Replies

9. Shell Programming and Scripting

Test function not working

i am writing the following snippet and cannot figure out why the variable measType remains 0. it should be 1 I also tried "\#analog" and '\#analog' in the test statement and it still doesn't work. What is going on? bash$ measType=0 bash$ read line < 2iconfig.ini bash$ echo $line #analog... (4 Replies)
Discussion started by: oahmad
4 Replies

10. UNIX for Advanced & Expert Users

Test -e not working as expected (by me)

I ran into the following and still do not understand entirely the rationale behind this. If someone could explain why things are as they are I'd be thankful. The following was tested on AIX 7.1 with ksh88, but i suspect that to be ubiquitous. In an installation routine i had to create a set of... (6 Replies)
Discussion started by: bakunin
6 Replies
GMP_DIV_QR(3)								 1							     GMP_DIV_QR(3)

gmp_div_qr - Divide numbers and get quotient and remainder

SYNOPSIS
array gmp_div_qr (GMP $n, GMP $d, [int $round = GMP_ROUND_ZERO]) DESCRIPTION
The function divides $n by $d. PARAMETERS
o $n - The number being divided. Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number. o $d - The number that $n is being divided by. Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number. o $round - See the gmp_div_q(3) function for description of the $round argument. RETURN VALUES
Returns an array, with the first element being [n/d] (the integer result of the division) and the second being (n - [n/d] * d) (the remainder of the division). EXAMPLES
Example #1 Division of GMP numbers <?php $a = gmp_init("0x41682179fbf5"); $res = gmp_div_qr($a, "0xDEFE75"); printf("Result is: q - %s, r - %s", gmp_strval($res[0]), gmp_strval($res[1])); ?> SEE ALSO
gmp_div_q(3), gmp_div_r(3). PHP Documentation Group GMP_DIV_QR(3)
All times are GMT -4. The time now is 05:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy