Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

eval(n) [opendarwin man page]

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. KEYWORDS
concatenate, evaluate, script SEE ALSO
catch(n), concat(n), error(n), list(n), subst(n), tclvars(n) Tcl eval(n)

Check Out this Related Man Page

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)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

StartX

Hi guys :) I'm having a slight problem. Every time I run the StartX command from my csh, it just says cannot access terminal. Can anyone tell me why this is and what it means? Thank you :) hellz. (15 Replies)
Discussion started by: hellz
15 Replies

2. UNIX for Dummies Questions & Answers

Retrieval of deleted files

We have a situation in a large dept of programmers where critical accounting data files were deleted. Is there any way in UNIX to trace deletions and or possibly retrieve the deleted file? (14 Replies)
Discussion started by: cgardiner
14 Replies

3. Shell Programming and Scripting

* character evaluating too soon - Help!

I have a user defined configuration file, which could contain the following type of entries: directory_001=/a/directory/structure pattern_001=fred* pattern_002=* I have a script which reads the file generically which will loop round loop 1 genvar=”directory” iteration=”001” ... (11 Replies)
Discussion started by: Bab00shka
11 Replies

4. Shell Programming and Scripting

loop through logged on users or file?

Hi I'm trying to loop through all logged on users and get their real names So I came up with this script but it doesn't work Who > userList #save logged on users to temp file while read username #loop through file do awk '{ print $1 }' | grep /etc/passwd |... (12 Replies)
Discussion started by: sixpack434
12 Replies

5. Shell Programming and Scripting

displaying 3 directory listings in 3 separate columns.

i having problems figuring out how to 'read' in 3 different directory listings and then display them on the screen into 3 separate columns. i thought i could use a 'for' loop to grab each directory and then assign a unique variable to each line 'read' in. of course, as you experts all know,... (16 Replies)
Discussion started by: mjays
16 Replies

6. UNIX for Dummies Questions & Answers

cut awk dummy question :)

how to make cut and awk treat "a b" as a single column rather then two separate columns "a and b"? how to remove " symbol from "a b" so there is only a b? Please help Regards Karol (14 Replies)
Discussion started by: sopel39
14 Replies

7. Shell Programming and Scripting

eval in shell scripting

what is the real usage of eval in shell scripting whats the difference between $ cmd && eval cmd (10 Replies)
Discussion started by: mobydick
10 Replies

8. Shell Programming and Scripting

eval and variable assignment

Hi, i have an issue with eval and variable assignment. 1) i have a date value in a variable and that date is part of a filename, var1=20100331 file1=${var1}-D1-0092.xml.zip file2=${var2}-D2-0092.xml.zip file3=${var3}-D3-0092.xml.zip i am passing the above variables to a script via... (11 Replies)
Discussion started by: mohanpadamata
11 Replies

9. Shell Programming and Scripting

Resolve variable inside another variable

Hello Everyone, I am trying to resolve a variable inside another variable.Let me go straight to the example. Input: Query=$Table_1 Join $Table_2 (Query itself is a variable here) Now for two different cases I am assigning different values to Table_1 and Table_2 Case 1:... (14 Replies)
Discussion started by: vinay4889
14 Replies

10. Shell Programming and Scripting

Error in eval eval command to print html tags

anyone has any info on why this is complaining??? vivek@vivek-c5e55ef2e ~/TAC $ zoneCounter=1 vivek@vivek-c5e55ef2e ~/TAC $ optUsage1=23% vivek@vivek-c5e55ef2e ~/TAC $ eval eval echo "<th>Zone $zoneCounter </th><th align=\"left\"> \$optUsage$zoneCounter </th>" -bash: syntax error... (13 Replies)
Discussion started by: vivek d r
13 Replies

11. Shell Programming and Scripting

Eval

thank you (35 Replies)
Discussion started by: ratnalein88
35 Replies

12. Shell Programming and Scripting

Sourcing Env file with eval works with ksh but not BASH

Hi, I am running this on Redhat 5.10 I have a simple test script called test.sh which has the following contents and it uses the BASH shebang. ------------------------------------------------------------- #!/bin/bash eval `/tmp/filereader.pl /tmp/envfile.txt` echo "TESTPATH=$TESTPATH" ... (28 Replies)
Discussion started by: waavman
28 Replies

13. Shell Programming and Scripting

How to Force command substitution evaluation in bash?

OK, I'm striving to abide by all the rules this time. Here is a fragment of my windows10/cygwin64/bash script: export BUPLOG=$(BackupRecords --log "$src") robocopy $(BackupRecords -mrbd "$src" --path "$src") $(BackupRecords --appSwitches "$src") "$src" "$dst" $(BackupRecords --fileSwitches... (15 Replies)
Discussion started by: siegfried
15 Replies

14. Shell Programming and Scripting

Problem evaluating condition

First, given this bit of code (line numbers included for reference: 59 get_all_db () { 60 #echo getting all db 61 dblist=`egrep -i "product/12" /etc/oratab |grep -v "listener"|\ 62 awk -F\: '{print $1}'|sort` 63 echo list is $dblist 64 echo 65 echo 66 echo "INSTANCE_NAME ... (15 Replies)
Discussion started by: edstevens
15 Replies

15. Shell Programming and Scripting

Parsing a control file loop

Hi, Let's say I have a control file like this: RHEL apple "echo apple" RHEL bravo "ls -l bravo*" RHEL church "chmod church.txt" SUSE drive "chown user1 drive.txt" SUSE eagle "echo "eagle flies"" SUSE feather "ls -l feather*" HP-UX google "sed 's/^Google.*$/&\ ACTION: go to... (14 Replies)
Discussion started by: The Gamemaster
14 Replies