09-22-2009
I don't know about tcsh, but bash has different comparison operators for numbers and strings. So, by applying an arithmetic comparison, I will receive an error message if the operands are strings.
In code:
[code]
#!/bin/bash
if [ $1 -eq $1 2>/dev/null ]; then
echo Is number
else
echo Is NOT a number
fi
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
How can I check numeric value in shell?
I am passing one parameter (integer) and I want to restrict any other characters except 0-9.
./script xyz 10
Here 2nd parameter (10) should be integer only.
Can anyone help on this?
Malay (6 Replies)
Discussion started by: malaymaru
6 Replies
2. Shell Programming and Scripting
Hi Folks,
I'm using bash script. I would like to check whether input is a number or not.(Only positive numbers).. if space or non numeric is entered, it should say "invalid input". pls help..
thanks in adv.
Br///
Vijay. (1 Reply)
Discussion started by: Vijayakumarpc
1 Replies
3. Shell Programming and Scripting
Hi All,
Is there any code in Perl which can differentiate between numeric and non-numeric input? (11 Replies)
Discussion started by: Raynon
11 Replies
4. Shell Programming and Scripting
i have a input file like this
001|rahim|bajaj|20090102
while reading the file i need to check whether the first column is a number
second column is a name
is there any methodology to check for the same
thanks in advance (2 Replies)
Discussion started by: trichyselva
2 Replies
5. Shell Programming and Scripting
Hey guys, i was looking for some examples of how can i check if the use input is just using numerical. i came across an example using tr :
echo "read this"
read this
if ]`" ] ;
then
echo "True - only alpha and numeric"
else
echo "False - there are NON alpha and numeric stuff here!"
fi... (7 Replies)
Discussion started by: gregarion
7 Replies
6. Shell Programming and Scripting
ok im sorta stuck on this,
The user enters a car model and it has to check it in a text file in the current directory. If the car model is not in the file, user has to enter another model
This is what i have so far
read -p "Enter a car model: " car1
grep -w $car1=$(cat carMakes.txt)... (3 Replies)
Discussion started by: gangsta
3 Replies
7. Windows & DOS: Issues & Discussions
Hi
I need to put the validation in batch script when user will enter the build number it should be numeric.I can put the validation for numeric values but there is .(dot) in number so it would not take it as numeric.
Is it possible we can store it in variable and remove the .(dot) from the... (1 Reply)
Discussion started by: anuragpgtgerman
1 Replies
8. Shell Programming and Scripting
Hi,
I am working in bash in Mac OSX, I have following 'input.txt' file:
<INFO> HypoTestTool: >>> Done running HypoTestInverter on the workspace combined
<INFO> HypoTestTool: The computed upper limit is: 11 +/- 1.02651
<INFO> HypoTestTool: expected limit (median) 11
<INFO> HypoTestTool: ... (13 Replies)
Discussion started by: Asif Siddique
13 Replies
9. Shell Programming and Scripting
Hello there, find below for my code first:
$pdp_asaba=`cat /tmp/temp_total | grep asaba | sed 's/*//g'`
if ]]
then pdp_asaba=0
fi
$pdp_abuja=`cat /tmp/temp_total | grep abuja | sed 's/*//g'`
if ]]
then pdp_abuja=0
fi
$pdp_ojota=`cat /tmp/temp_total | grep ojota | sed 's/*//g'`
if ... (3 Replies)
Discussion started by: infinitydon
3 Replies
10. Shell Programming and Scripting
Gurus, Please need your help.
I'm saving a filetimestamp into $filetimestamp and
say....echo $filetimestamp gives 2015021612
I'm saving a cutoff_time into $cutoff_time
say....echo $cutoff_time gives 2015021514
now my requirement is to check if $filetimestamp is greater than... (4 Replies)
Discussion started by: thummi9090
4 Replies
LEARN ABOUT CENTOS
glgetshaderprecisionformat
GLGETSHADERPRECISION(3G) OpenGL Manual GLGETSHADERPRECISION(3G)
NAME
glGetShaderPrecisionFormat - retrieve the range and precision for numeric formats supported by the shader compiler
C SPECIFICATION
void glGetShaderPrecisionFormat(GLenum shaderType, GLenum precisionType, GLint *range, GLint *precision);
PARAMETERS
shaderType
Specifies the type of shader whose precision to query. shaderType must be GL_VERTEX_SHADER or GL_FRAGMENT_SHADER.
precisionType
Specifies the numeric format whose precision and range to query.
range
Specifies the address of array of two integers into which encodings of the implementation's numeric range are returned.
precision
Specifies the address of an integer into which the numeric precision of the implementation is written.
DESCRIPTION
glGetShaderPrecisionFormat retrieves the numeric range and precision for the implementation's representation of quantities in different
numeric formats in specified shader type. shaderType specifies the type of shader for which the numeric precision and range is to be
retrieved and must be one of GL_VERTEX_SHADER or GL_FRAGMENT_SHADER. precisionType specifies the numeric format to query and must be one
of GL_LOW_FLOAT, GL_MEDIUM_FLOATGL_HIGH_FLOAT, GL_LOW_INT, GL_MEDIUM_INT, or GL_HIGH_INT.
range points to an array of two integers into which the format's numeric range will be returned. If min and max are the smallest values
representable in the format, then the values returned are defined to be: range[0] = floor(log2(|min|)) and range[1] = floor(log2(|max|)).
precision specifies the address of an integer into which will be written the log2 value of the number of bits of precision of the format.
If the smallest representable value greater than 1 is 1 + eps, then the integer addressed by precision will contain floor(-log2(eps)).
ERRORS
GL_INVALID_ENUM is generated if shaderType or precisionType is not an accepted value.
COPYRIGHT
Copyright (C) 2010 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication
License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.
AUTHORS
opengl.org
opengl.org 06/10/2014 GLGETSHADERPRECISION(3G)