Sponsored Content
Full Discussion: Integer check (again)...
Top Forums UNIX for Dummies Questions & Answers Integer check (again)... Post 302293248 by giannicello on Monday 2nd of March 2009 05:46:38 PM
Old 03-02-2009
Thank you. These are simpler than what I have. Both solutions worked. The only caveat is that the first solution can case the program to terminate if a user input happens to include any non-numeric character. If you can control that then it's fine.

The second solution covers all basis as far as my testing went.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cannot store integer value

Hi , I have code like below in my ksh script, but getting an error as SP2-0253: data item 1 ("SAMPLE_ID") will not fit on line , pls help me. thanks. if (( CHECKS == 0 )) || (( CHECKS == 1 )) then V_SAMPLE_ID=$( $ORACLE_HOME/bin/sqlplus -S / <<EOF whenever sqlerror exit 1... (5 Replies)
Discussion started by: bennichan
5 Replies

2. UNIX for Dummies Questions & Answers

Rouding off an integer

HI I want to round off an integer to the next multiple of 10 in shell script. (i.e.,) 91 should be rounded off to 100 and 90 should be rounded off to 90 It would be very helpful, if you can help me in this. Thanks in advance (4 Replies)
Discussion started by: dayamatrix
4 Replies

3. UNIX for Dummies Questions & Answers

integer to string

Hi all, is there an easy way to convert integer to string in bash? I have numbers like 1, 2, ..., 112, ... and I would like to get 001 002 003 004 ... Thank you, Sarah (4 Replies)
Discussion started by: f_o_555
4 Replies

4. UNIX for Dummies Questions & Answers

Check if input is an integer or a floating point?

Hiii I actually intent to check the integer or floating point number input by user i.e. 23, 100, 55.25, 12.50 ..etc. However, when someone input strings or alpha character, my program has to show invalid input.!! Is there any Unix shell script syntax can help me to check ? Thanking you (2 Replies)
Discussion started by: krishnampkkm
2 Replies

5. Shell Programming and Scripting

Regex for for integer from 0-7 except 2

Hi, I am trying to use a regular exp to match any number between 0 and 7 except 2...... I am using: echo $myvar | egrep "{1}{1}" Which isnt working.... Please can someone help? Thanks yonderboy (10 Replies)
Discussion started by: yonderboy
10 Replies

6. Shell Programming and Scripting

Alphanumeric to integer

Hi folks, I have a value like A12,i could able to change this into integer using typeset as below typeset -i A12 But, I need your advice to change the values like 1A2 or 12A into integer. Thanks in advance. Thanks, Sathish (3 Replies)
Discussion started by: bsathishmca
3 Replies

7. Shell Programming and Scripting

Convert to Integer

Hi fellows!! i'm doing something which is not working out for me properly which i don't understand why nowdate=`date +%s` echo $nowdate now the problem how to convert a date which is stored in a variable mydate="22/Oct/2011" mydate=`date -d '$mydate' +%s` it gives error... (11 Replies)
Discussion started by: me_newbie
11 Replies

8. Shell Programming and Scripting

how to compare string integer with an integer?

hi, how to I do this? i="4.000" if ; then echo "smaller" fi how do I convert the "4.000" to 4? Thanks! (4 Replies)
Discussion started by: h0ujun
4 Replies

9. Shell Programming and Scripting

While Loop to Check for Integer

Hello All, In ksh I am trying to ensure that user inputs are integers otherwise redisplay prompt with the following code; a=0 b=0 c=0 read b?"Please enter a number: " read c?"Please enter another number: " while ] && ]; do read b?"Not a number. Please enter a number: " read c?"Not... (4 Replies)
Discussion started by: techieg
4 Replies

10. Solaris

Integer Validation

Hi Using the below logic to check whether the value is integer or not and converting the value to decimal if not. int_chck = sprintf(substr($i, 1, 2)) o_cnt = 'if ; then echo $int_chck; else echo $((0x$int_chck)); fi' Thanks, Dines (4 Replies)
Discussion started by: dineshnak
4 Replies
BUFINFO(3PVM)							  PVM Version 3.4						     BUFINFO(3PVM)

NAME
pvm_bufinfo() - Returns information about a message buffer. SYNOPSIS
C int info = pvm_bufinfo( int bufid, int *bytes, int *msgtag, int *tid ) Fortran call pvmfbufinfo( bufid, bytes, msgtag, tid, info ) PARAMETERS
bufid Integer specifying a particular message buffer identifier. bytes Integer returning the length in bytes of the body of the message. This will be equal to the actual size of the data packed, if PvmDataRaw is used, otherwise it may include pad bytes. msgtag Integer returning the message label. Useful when the message was received with a wildcard msgtag. tid Integer returning the source of the message. Useful when the message was received with a wildcard tid. info Integer status code returned by the routine. Values less than zero indicate an error. DESCRIPTION
The routine pvm_bufinfo returns information about the requested message buffer. Typically it is used to determine facts about the last received message such as its size or source. pvm_bufinfo is especially useful when an application is able to receive any incoming message, and the action taken depends on the source tid and the msgtag associated with the message that comes in first. If pvm_bufinfo is success- ful, info will be 0. If some error occurs then info will be < 0. EXAMPLES
C: bufid = pvm_recv( -1, -1 ); info = pvm_bufinfo( bufid, &bytes, &type, &source ); Fortran: CALL PVMFRECV( -1, -1, BUFID ) CALL PVMFBUFINFO( BUFID, BYTES, TYPE, SOURCE, INFO ) ERRORS
This error condition can be returned by pvm_bufinfo. PvmNoSuchBuf specified buffer does not exist. PvmBadParam invalid argument SEE ALSO
pvm_recv(3PVM) 30 August, 1993 BUFINFO(3PVM)
All times are GMT -4. The time now is 11:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy