Hi everybody,
I want to know how can i use the command 'expr' to manipulate float number , i have a shell bash and when (for example) i do:
y1=`expr \( 1/ 16 \)`
it returns 0
and if i do
y1=`expr \( 1.6 / 16 \)`
it returns non numeric argument.
is there another command for mathematic... (4 Replies)
quick question, I am trying to run this simple equation
expr 2048 / 2.354
but get a "expr: non-numeric argument" error when ever its run. I believe it may be caused by the decimal point but I do not know how to remedy it. (3 Replies)
hi there,
I was recently introduced to this site by a friend. I hope you guys can help with a code error i can't seem to debug.I can get to add two different data types together. A snippet of the code is below:
echo -n "Enter Your MOnthly Investment"
read Inv
PIP= $(echo "scale=2; 10 / 100"... (4 Replies)
Hi everyone, I want my script to check if the first argument has only numbers or not. Im not sure what im doing wrong.
This is how it looks like:
if *") ]
then
echo 'The first arguement should only be in numeric' 1>&2
exit 1
else
exit 0
fi (7 Replies)
Hi all,
In KSH, I have got an error message like,
"expr: Integer argument too large"
I received this error message when I mutiply two large values and displaying the resultant output.
Is there any other altenative way to go with too large values?
Kindly let me know asap...
Thanks in... (12 Replies)
I am running AIX 5.3 using the Korn Shell. I am reading file names from a file, as an example:
E0801260
E0824349
E0925345
EMPMSTR
statement "num=$(expr substr "$DDNAME" 4 2)
extracts the numeric values fine. But when I het the last entry, it returns num=MS, but I get an error... (19 Replies)
Hi,
How to return the string "y" to the calling function.
Getting the below error when function returns the value.
return: y: numeric argument required
With Regards (2 Replies)
i wrote this simple shell script
#!/bin/bash
read N1
read N2
expr $N1 + $N2
it work fine in bash and i add it on xinetd for some test but when i try to use in with telnet i got this error :
ehsan@debian:~$ telnet 192.168.1.4 1234
Trying 192.168.1.4...
Connected to 192.168.1.4.... (14 Replies)
This is my code.... It works correct, but does not work with 4 and 5. My program is about finding average. so when i run 4 5 it gives me error "expr: non-integer argument".
But when i say sh average 45 67 it works. Whats wrong?how to fix it?
sum=0
n=0
if
then
for i in $*
do
if
... (2 Replies)
Hi,
I tried to look up the issue i'm experiencing, but i'm confused what's wrong with my script.
After executing the script I'm getting the following error
expr: non-numeric argument
syntax error on line 1, teletype
After some research, it seems that the problem relates to bc.
I have... (1 Reply)
Discussion started by: nms
1 Replies
LEARN ABOUT SUSE
tcl_exprboolean
Tcl_ExprLong(3) Tcl Library Procedures Tcl_ExprLong(3)__________________________________________________________________________________________________________________________________________________NAME
Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString - evaluate an expression
SYNOPSIS
#include <tcl.h>
int
Tcl_ExprLong(interp, expr, longPtr)
int
Tcl_ExprDouble(interp, expr, doublePtr)
int
Tcl_ExprBoolean(interp, expr, booleanPtr)
int
Tcl_ExprString(interp, expr)
ARGUMENTS
Tcl_Interp *interp (in) Interpreter in whose context to evaluate expr.
const char *expr (in) Expression to be evaluated.
long *longPtr (out) Pointer to location in which to store the integer value of the expression.
int *doublePtr (out) Pointer to location in which to store the floating-point value of the expression.
int *booleanPtr (out) Pointer to location in which to store the 0/1 boolean value of the expression.
_________________________________________________________________DESCRIPTION
These four procedures all evaluate the expression given by the expr argument and return the result in one of four different forms. The
expression can have any of the forms accepted by the expr command. Note that these procedures have been largely replaced by the object-
based procedures Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, and Tcl_ExprObj. Those object-based procedures evaluate an
expression held in a Tcl object instead of a string. The object argument can retain an internal representation that is more efficient to
execute.
The interp argument refers to an interpreter used to evaluate the expression (e.g. for variables and nested Tcl commands) and to return
error information.
For all of these procedures the return value is a standard Tcl result: TCL_OK means the expression was successfully evaluated, and
TCL_ERROR means that an error occurred while evaluating the expression. If TCL_ERROR is returned then the interpreter's result will hold a
message describing the error. If an error occurs while executing a Tcl command embedded in the expression then that error will be
returned.
If the expression is successfully evaluated, then its value is returned in one of four forms, depending on which procedure is invoked.
Tcl_ExprLong stores an integer value at *longPtr. If the expression's actual value is a floating-point number, then it is truncated to an
integer. If the expression's actual value is a non-numeric string then an error is returned.
Tcl_ExprDouble stores a floating-point value at *doublePtr. If the expression's actual value is an integer, it is converted to floating-
point. If the expression's actual value is a non-numeric string then an error is returned.
Tcl_ExprBoolean stores a 0/1 integer value at *booleanPtr. If the expression's actual value is an integer or floating-point number, then
they store 0 at *booleanPtr if the value was zero and 1 otherwise. If the expression's actual value is a non-numeric string then it must
be one of the values accepted by Tcl_GetBoolean such as "yes" or "no", or else an error occurs.
Tcl_ExprString returns the value of the expression as a string stored in the interpreter's result.
SEE ALSO
Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj
KEYWORDS
boolean, double, evaluate, expression, integer, object, string
Tcl 7.0 Tcl_ExprLong(3)