Here is an example of what i'm doing...
foo = "rm /Users/local/Send\ Registration"
puts [linsert $foo 0 exec]
and here is the result "exec rm {/Users/heizer1/Send Registration}"
eventually 'm going to replace the puts with eval.
thanks,
- Charles
> I'm trying to do a linsert and it's removing my backlash from my string.
No it isn't.
> Here is an example of what i'm doing...
>
> foo = "rm /Users/local/Send\ Registration"
You don't have a backslash in your string. You have an escaped space. And
neither are you doing that, assignments are done with [set], not with =.
> puts [linsert $foo 0 exec]
>
> and here is the result "exec rm {/Users/heizer1/Send Registration}"
You see those curly braces? You didn't write those, but Tcl changed your
backslash-escaped-string to a "properly" quoted string. Backslash is still
"there", but it isn't visible. Space has been escaped in both cases.
> eventually 'm going to replace the puts with eval.
That should be no problem, [linsert] gives you a list, and parameter to rm
has been escaped, so eval just destroys that outermost list. I guess and
hope. I try to avoid [eval] because it is sure that somewhere it will rm
all my files due missing listification :)
But your case seems to be fine. Though someone else should check that out.
--
-Kaitzschu
s="TCL ";while true;do echo -en "\r$s";s=${s:1:${#s}}${s:0:1};sleep .1;done
It should have read ...
set foo "rm /Users/local/Send\ Registration"
not
foo = "rm /Users/local/Send\ Registration"
thanks, for the info on the result explanation, I dd not realize that
the backslash was invisable.
Thanks,
- charles
The backslashisn't "invisible". The "" interpret the backslash inside.
Just like in C, a '\n' is a newline character with no backslash inside
it, in Tcl a "\ " is just a space. If you want to insert a backslash
into a string delimited with double-quotes, use \\, just like in C.
--
Darren New / San Diego, CA, USA (PST)
The samba was clearly inspired
by the margarita.
Carefully form proper lists and you shouldn't have any problems.
set foo [list rm {/Users/local/Send Registration}]
puts [linsert $foo 0 exec]
.
.
.
eval [linsert $foo 0 exec]
Semi off topic. You really should be using [file delete] instead of
[exec rm].
-Brian
- Charles
Which problems?
| and it also supporting recursive deletes including directories.
Use
file delete -force
to delete directories. See documentation for details.
R'