[comp.unix.shell] ksh - how do you keep aliases permanent?

rad@genco.bungi.com (Bob Daniel) (03/09/91)

When defining aliases, is there a way to keep them permanent as they are defined
rather than inserting them directly into .profile?  If I have to, I'll write
something that makes aliases and stores them in a file that is launched by
.profile at login but would like to know if it can be done before spending 
time on that routine.

lvc@cbnews.att.com (lawrence.v.cipriani) (03/11/91)

In article <544@genco.bungi.com> rad@genco.bungi.com (Bob Daniel) writes:
>When defining aliases, is there a way to keep them permanent as they are defined
>rather than inserting them directly into .profile?  If I have to, I'll write
>something that makes aliases and stores them in a file that is launched by
>.profile at login but would like to know if it can be done before spending 
>time on that routine.

I guess I'm not entirely certain what you mean by "keep them permanent."
If you want those aliases and functions accessible to sub-shells try this:
export and define a variable called ENV in .profile; $ENV is the name of
an environment file ksh will automatically "dot" after .profile when you
login.  You do not have to say . $ENV in your .profile, it is redundant
[at login].
-- 
Larry Cipriani, att!cbvox!lvc or lvc@cbvox.att.com
"Fight fire with fire, I always say" -- Bugs Bunny

rbr@bonnie.ATT.COM (4197,ATTT) (03/11/91)

In article <544@genco.bungi.com> rad@genco.bungi.com (Bob Daniel) writes:
>When defining aliases, is there a way to keep them permanent as they are defined
>rather than inserting them directly into .profile?  If I have to, I'll write
>something that makes aliases and stores them in a file that is launched by
>.profile at login but would like to know if it can be done before spending 
>time on that routine.

Store them in a file named ".kshrc" which will be read by ksh at login. At
least this is true "ksh" on AT&T UNIX V.  Other implementations may use a
different name for the file. Check your Ksh manual or talk to your system
administrator.

The following is an example showing a few lines from my ".kshrc".  You can
put them in one per line "alias <name> = 'command line' or bunch them as
I have.

alias   \
        lf='ls -CF'                \
        ll='ls -l'                 

Bob Rager

rad@genco.bungi.com (Bob Daniel) (03/12/91)

In article <1991Mar11.041751.18032@cbnews.att.com> lvc@cbnews.att.com (lawrence.v.cipriani) writes:
>In article <544@genco.bungi.com> rad@genco.bungi.com (Bob Daniel) writes:
>>When defining aliases, is there a way to keep them permanent as they are defined
>>rather than inserting them directly into .profile?  If I have to, I'll write

>I guess I'm not entirely certain what you mean by "keep them permanent."
>If you want those aliases and functions accessible to sub-shells try this:
>export and define a variable called ENV in .profile; $ENV is the name of
>an environment file ksh will automatically "dot" after .profile when you
>login.  You do not have to say . $ENV in your .profile, it is redundant
>[at login].

Whenever setting up aliases, they are gone when I log out.  I want to keep
aliases permanent for the next time I login.  

karish@mindcraft.com (Chuck Karish) (03/14/91)

In article <557@genco.bungi.com> rad@genco.bungi.com (Bob Daniel) writes:
>Whenever setting up aliases, they are gone when I log out.  I want to keep
>aliases permanent for the next time I login.  

In your .kshrc, set an exit trap to run the 'alias' builtin
and save the results in a file.  Have .kshrc use what's saved
in the file to set new aliases the next time you log in.

	Chuck Karish		karish@mindcraft.com
	Mindcraft, Inc.		(415) 323-9000