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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

noob question regarding variables 1

Status
Not open for further replies.

Nostradamus

Technical User
May 3, 2000
419
SE
I want to insert a variable in a set line.

for instance if a have a variable containing usernames $username and a want to set a new variable by inserting the this variable.

set x {/usr/home directories/$username}

When I try this it simply writes it as /usr/home/$username instead of inserting the value of the variable.

Hope you understand what I mean.

how do I do this using tcl?

/Sören
 
thanks a bunch.
I was told the {}´s was needed if I had spaces on the line. Obviously they ignore the $-variable. Sadly enough I never tried it with "". noobie question without a doubt, but now it's working.

*star*

/Sören
 
Hi

I found the Tcl/Tk documentations abit strange. My performance is better with differently structured documentations.

This is the part with the solution to your problem :
Tcl documentation said:
[4] Double quotes.
[gray](...)[/gray]Command substitution, variable substitution, and backslash substitution are performed on the characters between the quotes as described below.[gray](...)[/gray]

[5] Braces.
[gray](...)[/gray]No substitutions are performed on the characters between the braces except for backslash-newline substitutions described below, nor do semi-colons, newlines, close brackets, or white space receive any special interpretation.[gray](...)[/gray]

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top