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
gbsplayrc(5)						       Gameboy sound player						      gbsplayrc(5)

NAME
gbsplayrc - Gameboy sound player configuration file DESCRIPTION
/etc/gbsplayrc and ~/.gbsplayrc are used by gbsplay(1). SYNTAX
Comments are introduced by hash marks. A comment continues to the end of the line. Whitespace, including empty lines, is ignored. Option values follow the option name and an equal sign. Valid option value types are: Boolean An integer number in decimal. 0 is considered false, everything else is true. Endian A single character denoting the endianness. n == native endian, l == little endian and b == big endian. Integer An integer number in decimal. Plugin The name of an output plugin. Run gbsplay -o list to get a list of all available output plugins. OPTIONS
endian = Endian The output endianness. fadeout = Integer The fadeout time in seconds. Instead of cutting of the subsong hard, do a soft fadeout. loop = Boolean In loop mode the playback will restart from the beginning after the last subsong. output_plugin = Plugin The sound output plugin to be used. rate = Integer The samplerate to be used. refresh_delay = Integer Set the refresh delay in milliseconds. Larger values will lower CPU usage, but things as subsong changes, fadeouts, reactions to keypresses and the on-screen display will be delayed. silence_timeout = Integer The silence timeout in seconds. When a subsong contains silence for the given time, the player will skip to the next subsong. subsong_gap = Integer The subsong gap in seconds. Before playing the next subsong after the subsong timeout, play subsong_gap seconds of silence. subsong_timeout = Integer The subsong timeout in seconds. When a subsong has been played for the given time, the player will skip to the next subsong. A timeout of 0 seconds disables automatic subsong changes. verbosity = Integer Sets the verbosity level (default: 3). A value of 0 means no messages on stdout. FILES
/etc/gbsplayrc Default location of the global configuration file. ~/.gbsplayrc User configuration file. SEE ALSO
gbsplay(1), gbsinfo(1) BUG REPORTS
If you encounter bugs, please report them via http://gbsplay.berlios.de/ or write to <gbsplay-dev@lists.berlios.de>. AUTHOR
gbsplay was written by Tobias Diedrich <ranma+gbsplay@tdiedrich.de> (with contributions from others, see README). COPYRIGHT
gbsplay is licensed under GNU GPL. Tobias Diedrich 0.0.91 gbsplayrc(5)
All times are GMT -4. The time now is 10:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy