Hi All,
I came across a bit of code that seems to work, even though I didn't expect it to (now that's wierd!)
#!/bin/sh
set -x
nn=15
if
then
echo "is true"
fi
The above code ends up comparing the string "nn" to number 15, but still evaluates to true. Here's the output when i run it... (1 Reply)
Hi,
i want to print the mail exchange servers for a domain using the code below, the problem is that i just get the memory locations (?) of the elements in the output, instead of the mx servers.
I really tried to find a solution, but i guess that i just don't get it (objects, OOP etc).. :)
... (2 Replies)
// Hello all,
I am having this error "Dereferencing pointer to incomplete type " on these 2 lines:
xpoint = my_point->x;
ypoint = my_point->y;
I am having no clue y this is happening.
Any help would be greately appreciated!!!!
#include<stdio.h>
#include<string.h>... (2 Replies)
Hi,
This should be a simple one.
All I am doing is adding an email address to my email.
Example abc@xyz.com
I understand that the @ means arrays in PERL. So, I coded the backtick (`) to dereference it. But now I get abc`@`xyz.com
Your help is appreciated.
Thanks
Nurani (2 Replies)
Hi there, I am trying to dereference my hash of hashes but post dereferencing, it seems to lose its structure I am using Data::dumper to help me anaylise.
This is the code im using to build the HoH, (data comes from a file). I have also performed a Dumper on the data structure before and after... (1 Reply)
Simple enough problem I think, I just can't seem to get it right.
The below doesn't work as intended, it's just a function defined in a much larger script:
CheckValues() {
for field in \
Group_ID \
Group_Title \
Rule_ID \
Rule_Severity \
... (2 Replies)
I have a group of variables myLINEcnt1 - myLINEcnt10. I'm trying to printout the values using a for loop. I am at the head banging stage since i'm sure it has to be a basic syntax issue that i can't figure out.
For myIPgrp in 1 2 3 4 5 6 7 8 9 10; do
here i want to output the value of... (4 Replies)
Hello All,
Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....?
I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping
through a string containing some of these "Illegal Characters". Now... (5 Replies)
Hi All,
I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Hi guys
I am trying to dereference a variable inside 'egrep -v ' command and getting a 'egrep: syntax error' :
$ echo $exclude_list
ts584d hf584db
for i in `echo $exclude_list`; do
egrep -v ${i} my_file
done
egrep: syntax error
egrep: syntax error
The syntax of the loop is correct.... (1 Reply)
Discussion started by: aoussenko
1 Replies
LEARN ABOUT MOJAVE
eval
eval(n) Tcl Built-In Commands eval(n)
__________________________________________________________________________________________________________________________________________________NAME
eval - Evaluate a Tcl script
SYNOPSIS
eval arg ?arg ...?
_________________________________________________________________DESCRIPTION
Eval takes one or more arguments, which together comprise a Tcl script containing one or more commands. Eval concatenates all its argu-
ments in the same fashion as the concat command, passes the concatenated string to the Tcl interpreter recursively, and returns the result
of that evaluation (or any error generated by it). Note that the list command quotes sequences of words in such a way that they are not
further expanded by the eval command.
EXAMPLES
Often, it is useful to store a fragment of a script in a variable and execute it later on with extra values appended. This technique is
used in a number of places throughout the Tcl core (e.g. in fcopy, lsort and trace command callbacks). This example shows how to do this
using core Tcl commands:
set script {
puts "logging now"
lappend $myCurrentLogVar
}
set myCurrentLogVar log1
# Set up a switch of logging variable part way through!
after 20000 set myCurrentLogVar log2
for {set i 0} {$i<10} {incr i} {
# Introduce a random delay
after [expr {int(5000 * rand())}]
update ;# Check for the asynch log switch
eval $script $i [clock clicks]
}
Note that in the most common case (where the script fragment is actually just a list of words forming a command prefix), it is better to |
use {*}$script when doing this sort of invocation pattern. It is less general than the eval command, and hence easier to make robust in |
practice. The following procedure acts in a way that is analogous to the lappend command, except it inserts the argument values at the
start of the list in the variable:
proc lprepend {varName args} {
upvar 1 $varName var
# Ensure that the variable exists and contains a list
lappend var
# Now we insert all the arguments in one go
set var [eval [list linsert $var 0] $args]
}
However, the last line would now normally be written without eval, like this: |
set var [linsert $var 0 {*}$args] |
SEE ALSO
catch(n), concat(n), error(n), interp(n), list(n), namespace(n), subst(n), tclvars(n), uplevel(n)
KEYWORDS
concatenate, evaluate, script
Tcl eval(n)