Sponsored Content
Full Discussion: Syntax error in tcl/tk code
Top Forums Programming Syntax error in tcl/tk code Post 302357554 by Tytalus on Wednesday 30th of September 2009 06:52:14 AM
Old 09-30-2009
hmm - seems to dislike you setting the operator opr as +-*/ etc , then calculating.

you could maybe just rewrite so hitting the opr button does the insert e.g. :
Code:
proc SubOpr {} {
set result [expr { [ .entno1 get]  -   [ .entno2 get]}]
.entres insert 0 $result

And - you could do with a clear operation, or any new reults will be appended to the current string in the result..

HTH
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

2. Shell Programming and Scripting

why is this code generating syntax error?pls help

#!/bin/sh copy() { source=`stat -c %s $1` dest=0 cd $2 while ;do cp $1 $2 & pct=`((100 * $dest) / $source )` dest=`dest+1` echo -en ".$pct%\b\b\b" sleep 1 done } echo "starting now" copy /file1 /tmp (3 Replies)
Discussion started by: wrapster
3 Replies

3. AIX

nim mksysb error :/usr/bin/savevg[33]: 1016,07: syntax error

-------------------------------------------------------------------------------- Hello, help me please. I am trying to create a mksysb bakup using nim. I am geting this error, how to correct it ? : Command : failed stdout: yes stderr: no... (9 Replies)
Discussion started by: astjen
9 Replies

4. Shell Programming and Scripting

Need help line 35: syntax error: unexpected end of file only 34 lines of code

I am not sure what I am doing wrong here, I did some research and only confused myself further. Any help would be greatly appreciated. I need to make this work for work tomorrow. There are only 34 lines of code in this script, yet its complaining about line 35 Here is the code: ... (7 Replies)
Discussion started by: BkontheShell718
7 Replies

5. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

6. Shell Programming and Scripting

Need help with TCL code to find IP address from a URL

Need help with a a tcl code. Need to find out the ip address from a URL if it is present to do some activity. The URLs will be of the form <domain>?a=12345&d=somestring1(Note: c not present) <domain>?c=10.10.10.100&d=somestring1 <domain>?a=12345&b=somestring1&c=10.1.2.4&d=somestring2... (1 Reply)
Discussion started by: ampak
1 Replies

7. UNIX for Advanced & Expert Users

Error in tcl script

hi all , i am trying to link a file with another file present in some other location in tcl shell. This is the way i am doing it if {} { file link /data/athena_dev/tanvi/tcl/tanvi.log "/data/athena_dev/tanvi/tanvi.tcl" } I am getting the error that /data/athena_dev/tanvi/tcl/ta nvi.log... (1 Reply)
Discussion started by: harjinder
1 Replies

8. Shell Programming and Scripting

TCL: syntax error in expression with "*"

I'm using tcl scripts in ns2 ( network simulator) through cygwin. It works fine , however, I downloaded an example when i run it , I got the following syntax error: syntax error in expression with " *2" : unexpected operator * while executing : "expr $bw *2" invoked from within: "$ns... (1 Reply)
Discussion started by: ENG_MOHD
1 Replies

9. Shell Programming and Scripting

IF section problem. syntax error: unexpected end of file error

Hello, I have another problem with my script. Please accept my apologies, but I am really nooby in sh scripts. I am writing it for first time. My script: returned=`tail -50 SapLogs.log | grep -i "Error"` echo $returned if ; then echo "There is no errors in the logs" fi And after... (10 Replies)
Discussion started by: jedzio
10 Replies

10. UNIX for Beginners Questions & Answers

Syntax error in code snippet

Hello, I am attaching a code snippet. Some of the variables are set in earlier code like count, arrays harr1, harr2, barr1 and barr2. The code below gives syntax errors. I am very new to Bash. for (( i=0; i<=$(( $count -1 )); i++ )) do #Now read the element at barr2 location i. Also find... (2 Replies)
Discussion started by: ngabrani
2 Replies
fmlexpr(1F)							   FMLI Commands						       fmlexpr(1F)

NAME
fmlexpr - evaluate arguments as an expression SYNOPSIS
fmlexpr arguments DESCRIPTION
The fmlexpr function evaluates its arguments as an expression. After evaluation, the result is written on the standard output. Terms of the expression must be separated by blanks. Characters special to FMLI must be escaped. Note that 30 is returned to indicate a zero value, rather than the null string. Strings containing blanks or other special characters should be quoted. Integer-valued arguments may be pre- ceded by a unary minus sign. Internally, integers are treated as 32-bit, 2s complement numbers. The operators and keywords are listed below. Characters that need to be escaped are preceded by . The list is in order of increasing precedence, with equal precedence operators grouped within {} symbols. USAGE
Expressions expr | expr Returns the first expr if it is neither NULL nor 0, otherwise returns the second expr. expr & expr Returns the first expr if neither expr is NULL or 0, otherwise returns 0. expr { =, >, >=, <, <=, != } expr Returns the result of an integer comparison if both arguments are integers, otherwise returns the result of a lexical comparison. expr { +, - } expr Addition or subtraction of integer-valued arguments. expr { *, /, % } expr Multiplication, division, or remainder of the integer-valued arguments. expr : expr The matching operator : (colon) compares the first argument with the second argument which must be a regular expression. Regular expression syntax is the same as that of ed(1), except that all patterns are "anchored" (that is, begin with ^) and, therefore, ^ is not a special character, in that context. Normally, the matching operator returns the number of bytes matched (0 on failure). Alterna- tively, the (...) pattern symbols can be used to return a portion of the first argument. EXAMPLES
Example 1 Incrementing a variable Add 1 to the variable a: example% fmlexpr $a + 1 | set -l a Example 2 Setting a variable equal to a filename For $a equal to either /usr/abc/file or just file: example% fmlexpr $a : .*/(.*) | $a returns the last segment of a path name (that is, file). Watch out for / alone as an argument: fmlexpr will take it as the division opera- tor (see NOTES below). Example 3 A better representation of Example 2 example% fmlexpr //$a : .*/(.*) The addition of the // characters eliminates any ambiguity about the division operator (because it makes it impossible for the left-hand expression to be interpreted as the division operator), and simplifies the whole expression. Example 4 Counting characters in a variable Return the number of characters in $VAR: example% fmlexpr $VAR : .* EXIT STATUS
As a side effect of expression evaluation, fmlexpr returns the following exit values: 0 if the expression is neither NULL nor 0 (that is, TRUE) 1 if the expression is NULL or 0 (that is, FALSE) 2 for invalid expressions (that is, FALSE). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
ed(1), expr(1), set(1F), sh(1), attributes(5) DIAGNOSTICS
syntax error for operator/operand errors non-numeric argument if arithmetic is attempted on such a string In the case of syntax errors and non-numeric arguments, an error message will be printed at the current cursor position. Use refresh to redraw the screen. NOTES
After argument processing by FMLI, fmlexpr cannot tell the difference between an operator and an operand except by the value. If $a is an =, the command: example% fmlexpr $a = = looks like: example% fmlexpr = = = as the arguments are passed to fmlexpr (and they will all be taken as the = operator). The following works, and returns TRUE: example% fmlexpr X$a = X= SunOS 5.11 5 Jul 1990 fmlexpr(1F)
All times are GMT -4. The time now is 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy