[comp.unix.questions] The USE OF ALIAS

jeffm@uokmax.ecn.uoknor.edu (Jeff Medcalf) (11/09/89)

In article <5398@uhccux.uhcc.hawaii.edu> bill@uhccux.uhcc.hawaii.edu (William J. King) writes:
>
>anybody know how to use an alias from my .login when i have
>substituted user to another's?
>bill@uhccux.bitnet

I have a file called .alias, which contains all of my aliases.  In my .cshrc
file, I have a line source ~/.alias  (which also works when I am not in my
home directory).

This way, from anywhere in the filesystem, I can say source ~jeffm/.alias
to get my aliases (if I am su'd, otherwise, ~/.alias).  Or I can say source
~jeffm/.cshrc, which also sets my environment variables.

This is the most efficient way that I know.


-- 
Jeff Medcalf	 jeffm@uokmax.uucp	jeffm@uokmax.ecn.uoknor.edu
!chinet!uokmax!jeffm	jeffm@invent_an_address (as reliable as the preceeding)
In 1869, the waffle iron was invented, thus solving the annoying tendency of
waffles to wrinkle in the dryer.

matthew@sunpix.UUCP ( Sun Visualization Products) (11/10/89)

In article <5398@uhccux.uhcc.hawaii.edu> bill@uhccux.uhcc.hawaii.edu (William J. King) writes:
>
>anybody know how to use an alias from my .login when i have
>substituted user to another's?
>bill@uhccux.bitnet

  The simplest way that comes to mind, is to have all your aliases in their own
file. (i.e. '.alias')  Your own .login can source them when needed, and you can
also source them when you are 'su'ed.


  In your .login:

	if ( -f .alias ) source .alias


  And while su'ed:

	su@machine% source /home/yourlogin/.alias

  Your aliases are now overlayed on top of the aliases specified by the su'ed
account.


-- 
Matthew Lee Stier                            |
Sun Microsystems ---  RTP, NC  27709-3447    |     "Wisconsin   Escapee"
uucp:  sun!mstier or mcnc!rti!sunpix!matthew |
phone: (919) 469-8300 fax: (919) 460-8355    |

jik@athena.mit.edu (Jonathan I. Kamens) (11/10/89)

In article <20556@unix.cis.pitt.edu> yahoo@unix.cis.pitt.edu (Kenneth L Moore)
writes:
>Thanks Jeff, I knew about source ~/.tshrc or ~/.cshrc but didn't 
>know about source ~/.alias.

  I find this comment a bit bewildering.  What is there to "know"
about a file called ~/.alias?  It is not a special file.  It is just a
file called .alias, which just happened to be chosen as a good name
for a file to store command aliases in.

  It's not like .cshrc or .tshrc, because the system does not execute
it automatically.  And it is not endowed by any magical qualities that
make it necessary for someone to have to tell you about it just
because it starts with a dot.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710