1

I am a beginner with tcl. I am trying to use primetime execute command, but it can't accept variable. For example:

set var "get_timing_paths -rise_from A -rise_to B"
set path0001 [$var]

But it doesn't work. The things I want to do is

set path0001 [get_timing_paths -rise_from A -rise_to B]

but I need to seperate it.

Thank you for your answer.

3
  • sorry, I am not good at this website. Commented Aug 9, 2017 at 4:18
  • set var "get_timing_paths -rise_from A -rise_to B" Commented Aug 9, 2017 at 4:19
  • set path0001 [$var] Commented Aug 9, 2017 at 4:19

2 Answers 2

5

If you're using Tcl/Tk 8.5 or newer, it'd be better to use the list expansion operator {*} instead of eval:

set var "get_timing_paths -rise_from A -rise_to B"
set path0001 [{*}$var]

It's a bit faster and safer.

Sign up to request clarification or add additional context in comments.

2 Comments

It's quite a lot faster. Possibly hugely so if you build the command to run with list.
I was using exec. So, I used it like this: set TTY "| tee /dev/tty" if [catch {exec sh s.sh {*}$TTY} result] { puts "Caught"}
0

Just add eval while calling the command.

set path0001 [eval $var]

Reference : eval

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.