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

how to soure unix .cshrc file using tcl/tk?

Status
Not open for further replies.

rotomac

Technical User
Sep 24, 2003
13
US
Hi all,

I want to source the .cshrc file using tcl/tk.
my .cshrc file contains follwoing:
alias herc1 'set path = (/home/user/her1/bin $path)
alias her2 'set path = (/home/user/her2/bin $path)

That what i am doing in my terminal window,
source .cshrc
herc1
which herc
/home/user/her1/bin/herc


so,i just want to source my .cshrc using my tcl script.
how can i do that?

Thanks
Roto

 
The .cshrc file is to be sourced by your csh shell when you log in. Its purpose is to add aliases to your first csh shell and all its children.

When you run a Tcl script you are using a child of this first csh shell. And when the Tcl script will exit all the updates of the environment will go.

I think you misunderstood the action you intended.
So, can you say why do you wanted to source a .cshrc with a Tcl script? What was intended?

ulis

 
hi ulis,

I have one user .csh files which contains some setenv and alias commands. I want to source this file using tcl script. As you mentioned that "When you run a Tcl script you are using a child of this first csh shell. And when the Tcl script will exit all the updates of the environment will go".
Is it possible to keep the environment setting even after exit from the tcl script atleast for that unix terminal?

Thanks
Roto
 
No, it's not possible.
The only wait is to source the .cshrc file thru the source mechanism of csh (it's
Code:
. .shrc
with sh but I don't know how for csh).

ulis
 
hi ulis,

Fine. So you mean to say that there is no way to set the unix environment by tcl?

Thanks
Roto
 
you can "set env(PATH) ..." or whatever you want. These will only be valid inside the Tcl shell for that session.

Bob Rashkin
rrashkin@csc.com
 
It's not Tcl, it's Unix.
No program can set the environment and let it remaining after leaving.
Only shells can modify the environment and keep it for the next commands launched from the same shell process.

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top