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 define a global alias ?

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
I would like to define a global alias that works in all shells AND subshells,,,how do I do that ?<br>The alias -x command does not work.<br>Steps;<br>1.&nbsp;&nbsp;Define an alias; alias -x rm='rm -ei'<br>2.&nbsp;&nbsp;ksh to a new shell<br>3.&nbsp;&nbsp;the alias is not defined<br><br>
 
As 'root' put it in /etc/environment at the end of the file.&nbsp;&nbsp;That way it goes into the system's environment, no matter what shell you're using. <p>Jon Zimmer<br><a href=mailto:b0rg@pcgeek.net>b0rg@pcgeek.net</a><br><a href= Aetea Information Technology</a><br>The software required `Windows 95 or better', so I installed Linux.<br>
 
No... aliases are not exportable variables, but you can use an <b>ENV</b> file. Do this:<br><br>In your <FONT FACE=monospace>.profile</font> put<br><FONT FACE=monospace><br>export ENV=$HOME/<font color=red>.kshrc</font><br></font><br><br>then create that <FONT FACE=monospace>.kshrc</font> file, with lines like:<br><FONT FACE=monospace><br>alias aname='text of alias'<br></font><br><br>Whenever <b>ksh</b> starts (parent or subshell) it will run the ENV file. You can put aliases and &quot;set&quot; options (like set -o vi).<br><br>I hope it works...
 
Sorry, you're right ElgisRamon.&nbsp;&nbsp;Also if you want to use this on other shells (i.e., csh) you would have to create .cshrc that does the same thing. But the .cshrc would read: <b>set</b> ENV=$HOME/.cshrc instead of <b>export</b>. <p>Jon Zimmer<br><a href=mailto:b0rg@pcgeek.net>b0rg@pcgeek.net</a><br><a href= Aetea Information Technology</a><br>The software required `Windows 95 or better', so I installed Linux.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top