On Sun, Mar 17, 2013 at 8:54 PM, Robert Connolly <rob...@secondfloor.ca> wrote:
> Hi. I have tried using both ~/.kshrc and ~/.profile to set an alias such as:
> alias ls='ls -F'
> and it doesn't work automatically on login. The files are being sourced,
> because my definition of PATH and PKG_PATH work.

That just says that some parent of this process sourced them, as
environment variables like PATH are inherited from the parent.
aliases, functions, and 'set' flags are not inherited but rather must
be set anew in each shell process.  That's what the ENV environment
variable is for: you set (and export!) it to the path of a file that
sets up your aliases, functions, and 'set' flags.

For example:

$ echo $ENV
/home/users/guenther/.kshrc
$ head $ENV
# Setting EDITOR changes this.  Switch it back
set -o emacs

bind '^V'=quote
test -t 0 && stty status ^T

l  () { ls -la "$@"; }
ll () { ls -la "$@"; }
z  () { suspend "$@"; }
j  () { jobs -l "$@"; }
$ grep ENV .profile
export ENV=~/.kshrc
$


The one other catch is that if you use xdm, then you should make
xterm's start login shells, because nothing before there will source
your .profile.  If you use startx (or xinit, I suppose), then the
console login you run that from will have sourced your .profile and
set ENV and the other environment variables.


Philip Guenther

Reply via email to