1753367 Members
5052 Online
108792 Solutions
New Discussion юеВ

Re: alias problem

 
SOLVED
Go to solution
iambluegary
Advisor

alias problem

i use alias name=string in sh,but when exit sh,the alias i wrote does not work any more,how can i make the alias can be used when out the sh.
help ,help,help :-)
3 REPLIES 3
Deepak Extross
Honored Contributor

Re: alias problem

Try setting the alias in your startup file ($HOME/.profile)
It should then be valid for your entire login session.
Hartmut Lang
Trusted Contributor
Solution

Re: alias problem

Settings like "alias" are setting for the shell (not for the environment the shell runs in). So if you leave the shell your changes are gone.
If you want your settings to visible to all shells, you have to make them at login time (e.g. in .profile). Since all the shells you run, are spawned (are subshells) from your login shell.

Also see ENV for sh how to set shell-environment every time a new shell is started.

Hardy
federico_3
Honored Contributor

Re: alias problem

Try to put in your .profile the variable ENV like the following:

export ENV=file_name_you_want


After this create the file_name_you_want ( usually $HOME/.kshrc) inserting the alias definition.


Ciao Federico