Thanks to "dgp" on freenode for this tip!
% set decBackToHex [format %lx $hexInDec]
ffffffffffff
As per the "OPTIONAL SIZE MODIFIER" notation on http://tmml.sourceforge.net/doc/tcl/format.html.
I'm trying to do some fancy footwork with HEX numbers. Basically, I want to take a HEX number, convert to decimal, add some number (integer) to it, and convert it back to HEX.
% set hex 0xFFFFFFFFFFFF
0xFFFFFFFFFFFF
% set hexInDec [expr $hex]
281474976710655
% set decBackToHex [format %x...
Hi there!
I'm trying to get Tcl to run a 'find this string in all of these files' type of command.
From a shell (not Tcl), the following command works:
find . -type f -exec grep -ni my_search_text /dev/null {} \;
However, from Tcl, if we try to run:
exec find . -type f -exec grep -ni $tag...
HA! You ALMOST had it BONG!
Your idea of using "append" had no affect, however, the idea of placing EXEC within the string worked!
set strCmd "exec tar -X /tmp/tar-exclude -cvvf /tmp/myarchive.tar /dir/to/tar"
eval $strCmd
This is great. Thanks so much both of your for your help...
PS: That error message is slightly massaged.
The whole "ERROR: Could not compelete tar operation" and "Reason: " part are generated by my error catch proc.
The "tar: /tmp/tar-exclude -cvvf /tmp/myarchive.tar /dir/to/tar: No such file or directory" is the raw output from tar failing.
Still nothing:
I'll give specific details here:
exec tar -X /tmp/tar-exclude -cvvf /tmp/myarchive.tar /dir/to/tar
Works.
set tarArgs "-X /tmp/tar-exclude -cvvf $tmp/myarchive.tar $/dir/to/tar"
exec tar $tarArgs
ERROR: Could not complete tar operation
Reason: tar: /tmp/tar-exclude -cvvf...
Yes I'm positive it exists.
I think the problem is that the 'exec' command typically works as:
exec myexecutable arg0 arg1 arg2
However, when the args are stored as a variable:
set args "args0 args1 args2"
exec myexecutable $args
it tries to pass "myexecutable" the args as an ENTIRE string...
Trying:
exec "tar $tarArgs"
Results in:
ERROR: Could not complete tar operation
Reason: couldn't execute "tar -Xcvf /tmp/tar-exclude-file /tmp/MYFILE.tar /dir/to/tar": no such file or directory
Having trouble getting exec to work with a dynamic set of arguments for the binary it's execing.
Example:
exec tar -cvf /tmp/MYFILE.tar /dir/to/tar
This works, and the tar file is created.
However, what if the 'arguments' passed into tar might change based on version?
# If tar is newer...
I'm having the same type of question. I have some specific errors .. please see below
----
OS: Windows Vista Premium
Tcl Version: 8.4
Goal: Looking for write capabilities with Serial Port.
Code:
# In Windows, we open a channel with "com1"
=>set com [open com1: w]
file14c4158
# Configure...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.