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

How do I export an alias 1

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
If I logon to Unix and define an alias.
I want to start another shell (ie. ksh) and have that alias available to me.
How do I pass an alias to another shell ?
 
You can put the alias in your $HOME/.kshrc with the -x option to export it to other shells. In the .kshrc you can define other settings like you login prompt (PS1), environment variables, etc. Add the aliases you want.

alias -x me=whoami
 
A longer answer:

At logon your Korn shell will read and execute your $HOME/.profile file, and then, will search for a veriable named $ENV, if it exists and points to a file it will read that file and execute it.
And whenever a new Korn shell start again it will search for the file to re-execute it again. You can put in your $ENV file anything what you want to run at init in all your shells (like alias definitions!).

I hope it works...
I hope it works...
Unix was made by and for smart people.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top