.profile problem using set -o vi

The �set -o vi� command won't run in the .profile. WHY?
This has me puzzled as the problem seems to be too simple, but can't figure it out. Here's the info...
Running...
Generic sun4u sparc SUNW,Ultra-5_10
K shell
Here's the .profile
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
stty istrip
stty erase ^H

NDMAPICFG=/home/user01/cdunix/ndm/cfg/cliapi/ndmapi.cfg
export NDMAPICFG

PATH=/usr/bin:/usr/local/bin/:/usr/ucb:/etc:/home/user01/cdunix/ndm/bin:.
export PATH

set -o vi

So why is it not taking the set command in the .profile?

What's the error, either when you log in or if you type the command in at the command line? What's your shell (check /etc/passwd to be sure).

Carl

Shell is K shell
No error produced.

It doesn't appear to execuite the set -o vi command from the .profile. Once I'm at the command line set -o vi works just fine. I was hoping to set it up in the .profile

I think your logon shell must be ksh if you want to put set -o vi in the .profile

jimmyc, change that line to:
ps -f
set -o
set -o vi
set -o

and post the output when you logon.

I checked on a Solaris 8 box, with ksh and it works just fine. Make sure that your shell is indeed ksh and (this may be a bit silly) make sure that your home directory exists and that you have write permissions on it. Otherwise ksh won't be able to write to the .sh_history file and you won't get any history.

Cheers,

Output from Perderabo's request:
ps -f
UID PID PPID C STIME TTY TIME CMD
user01 6321 6320 0 06:25:43 syscon 0:00 ksh
user01 6325 6321 0 06:25:54 syscon 0:00 ps -f
set -o
Current option settings
allexport off
bgnice on
emacs off
errexit off
gmacs off
ignoreeof off
interactive on
keyword off
markdirs off
monitor on
noexec off
noclobber off
noglob off
nolog off
notify off
nounset off
privileged off
restricted off
trackall off
verbose off
vi off
viraw off
xtrace off

$ set -o vi
$ set -o
Current option settings
allexport off
bgnice on
emacs off
errexit off
gmacs off
ignoreeof off
interactive on
keyword off
markdirs off
monitor on
noexec off
noclobber off
noglob off
nolog off
notify off
nounset off
privileged off
restricted off
trackall off
verbose off
vi on
viraw off
xtrace off

See when the .profile runs it doesn't execuite the set -o vi. Only after I'm at the command prompt does it work. My home dir is fine I run lots of other scripts, pickup and drop off file from it. The only thing I can think of is... During the execuition of the .profile, if it spawns another k-shell runs the set -o vi there, then closed the shell, I would never see it.

Actually he wanted the info added to your .profile not on the command line (or at least that's how I read it since it's not working in the script but it is on the command line; you do the troubleshooting from where it doesn't seem to be working :slight_smile: ).

The only time I've experienced a problem is if something earlier doesn't run and .profile bails but I can't be sure that wasn't a Red Hat feature (so many systems :slight_smile: ). Are the other items working? The PATH modified and NDMAPICFG set? If you move the set command to the top of .profile, does it work?

Carl

Edit: Oh, and if you source your .profile does it work?

$ . ./.profile

Hay Carl, I think your on to something....
yes - the source did work.
yes - my path and ndmapicfg and "stty erase" does work

no - moving "set -o vi" to the top (above stty erase ^H) doesn't work
no - placing those command in the .profile did not help.

Grrr... this seems to easy to not work.

jimmy, you need to modify your .profile file as I indicated. Then you need to logon. Then you need to post the output from those commands. No, those lines will not solve anything. But if you would post the output they produce when you logon, we can probably figure out what is happening.

Here's the output from the commands in the .profile ....
Please see note at bottom.

Last login: Thu Dec 28 08:07:29 from 192.168.0.214
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
UID PID PPID C STIME TTY TIME CMD
jcusic 7813 7807 0 14:17:29 pts/2 0:00 ps -f
jcusic 7807 7804 1 14:17:24 pts/2 0:00 -ksh
Current option settings
allexport off
bgnice on
emacs off
errexit off
gmacs off
ignoreeof off
interactive on
keyword off
markdirs off
monitor on
noexec off
noclobber off
noglob off
nolog off
notify off
nounset off
privileged off
restricted off
trackall off
verbose off
vi on
viraw off
xtrace off
Current option settings
allexport off
bgnice on
emacs off
errexit off
gmacs off
ignoreeof off
interactive on
keyword off
markdirs off
monitor on
noexec off
noclobber off
noglob off
nolog off
notify off
nounset off
privileged off
restricted off
trackall off
verbose off
vi on
viraw off
xtrace off
$ -fs
set -o vi
set -o
ksh: -fs: not found
$ set -o vi
$ set -o
Current option settings
allexport off
bgnice on
emacs off
errexit off
gmacs off
ignoreeof off
interactive on
keyword off
markdirs off
monitor on
noexec off
noclobber off
noglob off
nolog off
notify off
nounset off
privileged off
restricted off
trackall off
verbose off
vi on
viraw off
xtrace off

Grrr... logon is a generic term which I didn't stop to think about. When I telnet in... It works at expected! But I don't use telnet. I use Hummingbird to make a xwindows connection. Here's the command used to make that connection.
/usr/openwin/bin/xterm -bg black -fg yellow -sb -title SUN01--172.16.25.12-- -geo 110x30
When I login using this method I don't get any output from those commands and the set -o vi doesn't work till entered from the command line.

The xterm man page says:

Thanks Perderabo !!! That did it. No wonder I couldn't figure it out. I was looking in the wrong place all the time... New xterm line is...
/usr/openwin/bin/xterm -ls -bg black -fg yellow -sb -title SUN01--172.16.25.12-- -geo 110x30