Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exec command limitation?

Status
Not open for further replies.

wilsoj2

Programmer
Dec 12, 2003
6
US
The following command would be executed in a unix shell:
ncelab -generic 'FILE_NAME => "./code/tc1"' work.tb:configuration

Note: The single and double quotes must be passed to the ncelab tool, (ie they cannot be removed, substituted).

I want to execute this in a tcl script, however the single quotes are causing the tclsh to incorrectly format the exec command that gets sent to the unix shell, for instance here is one attempt which doesn't preserve the original unix shell formatting (resulting in error when executed:)

catch { exec ncelab -generic 'FILE_NAME => "./code/test_case1"' work.tb:configuration} ncelabrtn

The error is:extra characters after close-quote.

Question: How can I format the command I want to pass to the exec command so that it gets sent to the shell exactly as if I typed it on the command line without using tcl?

One thing I tried was using \ before the single and double quotes, thinking that would be correct -- however it wasn't.

Any help would be greatly appreciated. Thank you!
 
note that tcl donest send commands to a shell, it comletly executes itself.

i think you should use some extra curly braces ( { & } ), eg,

exec ncelab -generic {FILE_NAME => "./code/text_case1"} work.tb:configuration

[tt]
Breadcrust (aka J@red)

Web - E-mail - net-head@softhome.net
Linux Reg. Number - 307180 ([/tt]
 
Thanks BC!

FYI to close this out, since I also wanted to do variable substitution and the {} force no substitution the completed solution I used included the following:

set FILENAME "./code/test_case1"
set config "gate"
set tb "tb13"
set generic "FILE_NAME => \"${FILENAME}\""
exec $ncelab -NOCOPYRIGHT -generic $generic work.c_${config}_$tb

Note: The original help from BC (ie. the example from BC) also worked like a charm, which allowed me to fully understand what I was doing in the first place.

Thanks again, Jim.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top