[comp.unix.questions] setting variable on Bourne-shell startup

dblack@pilot.njin.net (David Alan Black) (09/11/90)

Based on what I've read in TFM, I've tried to use ".profile" to create
and export an EDITOR variable (namely, vi - my main purpose here is to
circumvent emacs).

Simply put, I can't get it to work.  Even when .profile says:

EDITOR=vi
export EDITOR

and I say

%sh

I end up in the Bourne shell (which is good) with EDITOR pointing at emacs
(which isn't good).

Eventually, I would like to put a "sh" in .login so as to bypass the C-shell.
But I don't want to have to change EDITOR manually every time.

With thanks for any responses,


David Black
dblack@pilot.njin.net


                      "What competition?"

                        Mrs. Emma Peel

cpcahil@virtech.uucp (Conor P. Cahill) (09/11/90)

In article <Sep.10.22.17.05.1990.924@pilot.njin.net> dblack@pilot.njin.net (David Alan Black) writes:
>Based on what I've read in TFM, I've tried to use ".profile" to create
>and export an EDITOR variable (namely, vi - my main purpose here is to
>circumvent emacs).

Yes, putting it in .profile is the way to do it.  However, .profile is  
only read at the startup point for a "LOGIN" shell.  It is not read when
you run a sub-shell.

If you want the .profile read in a sub-shell you must explicitly run

	. $HOME/.profile

>Eventually, I would like to put a "sh" in .login so as to bypass the C-shell.
>But I don't want to have to change EDITOR manually every time.

What you should do is get your system administrator to change your login
shell to /bin/sh and thereafter your .profile will be run instead of 
your .login.

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 

jimr@hp-lsd.COS.HP.COM (Jim Rogers) (09/13/90)

If you have a BSD system (or others such as HP-UX) you can use the "chsh"
command to change your default login shell.

If you want the Bourne shell as your default then give the command:

chsh $LOGNAME /bin/sh

Henceforth your login shell will be the Bourne shell.
The valid values for shell names used with "chsh" are:
	/bin/sh
	/bin/csh
	/bin/ksh


Jim Rogers
Hewlett Packard Company

guy@auspex.auspex.com (Guy Harris) (09/16/90)

>The valid values for shell names used with "chsh" are:
>	/bin/sh
>	/bin/csh
>	/bin/ksh

On many systems (including 4.3BSD and later), the valid values for shell
names used with "chsh" are whatever the file "/etc/shells" says, or
"/bin/sh" and "/bin/csh" if that file doesn't exist.  I hope nobody
hardcoded those three into their system, except as a default if
"/etc/shells" doesn't exist....