05-02-2002
Add Two Variables
I hope this is not a stupid question. I need to add two script variables and expr give me an error message saying "non-numeric argument." But they have numeric values. BTW, I am using Borne shell. Any comments will be appreciated.
10 More Discussions You Might Find Interesting
1. Solaris
hi
I need to add environment variables for all users and make them available when they login.
I don't know which file to edit. Also these variables should be displayed when "env" command is executed.
Please help....which file is common for all users, without editing their specific .profile or... (2 Replies)
Discussion started by: ashish_uiit
2 Replies
2. Programming
Hello everybody,
I am having problem in converting byte array variables to Hexa String variables for Linux. I have done, converting byte array variables to Hexa String variables for Windows but same function doesn't work for linux. Is there any difference in OS ? The code for Windows is given... (2 Replies)
Discussion started by: ritesh_163
2 Replies
3. Shell Programming and Scripting
Hello, Im writing a script that works by recursively going into directories with find. But I have some directories that have spaces in them.. so I need to parse the variables to add a backslash before the spaces.
Im not exactly sure how how to do this in bash, and honestly I dont think I know... (3 Replies)
Discussion started by: trey85stang
3 Replies
4. Shell Programming and Scripting
Hi Eveyone,
I am working on one shell script to find the specific records from data file and add the totals into variables and print them. you can find the sample data file below for more clarification.
Sample Data File:
PXSTYL00__20090803USA
CHCART00__20090803IND... (7 Replies)
Discussion started by: veeru
7 Replies
5. Shell Programming and Scripting
Hi All,
I have a file, let's call it "info.tmp" that contains data like this ..
ABC123456
PCX333445
BCD789833
I need to read "info.tmp" and for each line add strings in a way that the final output is
put /logs/ua/dummy.trigger 'AAA00001.FTP.XXX.BLA03A01.xxxxxx(+1)'
where XXX... (5 Replies)
Discussion started by: Andy_ARG
5 Replies
6. Shell Programming and Scripting
Dear all, today I'm scratching my head with a simple (I believe) issue.
Working with date is quite simple, so if I Need to add some seconds to current time, I'll use:
date --date='+30 seconds' +"%Y-%m-%d %H:%M:%S"But, how to pass the value to add from a variable? I tried the following without... (2 Replies)
Discussion started by: Lord Spectre
2 Replies
7. Shell Programming and Scripting
Hi All,
i have a requirement where i have to run a script with at least 25 arguements and position of arguements can also change. the unapropriate way is like below. can we achieve this in more good and precise way??
#!/bin/ksh
##script is sample.ksh
age=$1
gender=$2
class=$3
.
.
.... (3 Replies)
Discussion started by: Lakshman_Gupta
3 Replies
8. Shell Programming and Scripting
Sometimes it is handy to protect long scripts in C++.
The following syntax works fine for simple commands:
#define SHELLSCRIPT1 "\
#/bin/bash \n\
echo \"hello\" \n\
"
int main ()
{
cout <<system(SHELLSCRIPT1);
return 0;
}
Unfortunately for there are problems for:
1d arrays:... (10 Replies)
Discussion started by: frad
10 Replies
9. Shell Programming and Scripting
Trying to do so
echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies
10. UNIX for Dummies Questions & Answers
Below are three variables, which I want to pass into variable RESULT1
username1=userid
poihostname1=dellsys.com
port1=8080
How can I pass these variables into below code...
RESULT1=$((ssh -n username1@poihostname1 time /usr/sfw/bin/wget --user=sam --password=123 -O /dev/null -q... (4 Replies)
Discussion started by: manohar2013
4 Replies
LEARN ABOUT MOJAVE
tcl_exprstring
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)