?
Solved

vi errors

Posted on 2003-02-27
17
Medium Priority
?
547 Views
Last Modified: 2013-12-27
I am running CDE, the default for Solaris 8 v 2/02.
Earlier I changed the defaults to the /etc/.login file to get rid of the mail prompt on login, as I am not running mail services on my Sparc20.  This (I believe) is the file that governs all CDE logins, and I know I should have backed it up, but I didn't. (I could find no way to disable the prompt in my own login file either, another question) Anyway this got rid of the mail prompt, and the system worked fine for a while, but now vi doesn't work for users and root, and the problem may be with edits I made to this file.  

Env variables look ok for users and root, and when I could see my .dtlogin file it was ok, but now when I try to vi I see part of the file I am trying to edit, mixed in with the local directory structure.

I checked the error logs in /var/adm, there is nothing to help me there.  Let me know if it's time for a system reload, or if there is a less painful solution, thanks

Christine

0
Comment
Question by:klukac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
  • +3
17 Comments
 
LVL 2

Expert Comment

by:ryanf
ID: 8033894
Here is the contents of .login:
--BEGIN PASTE--
#ident  "@(#)login.csh  1.7     98/10/03 SMI"

# The initial machine wide defaults for csh.

if ( $?TERM == 0 ) then
        if { /bin/i386 } then
                setenv TERM sun-color
        else
                setenv TERM sun
        endif
else
        if ( $TERM == "" ) then
                if { /bin/i386 } then
                        setenv TERM sun-color
                else
                        setenv TERM sun
                endif
        endif
endif

if (! -e .hushlogin ) then
        /usr/sbin/quota
        /bin/cat -s /etc/motd
        /bin/mail -E
        switch ( $status )
        case 0:
                echo "You have new mail."
                breaksw;
        case 2:
                echo "You have mail."
                breaksw;
        endsw
endif
--END PASTE--

Also, what happens when you try to launch vi?  Any error message on the screen?

By the looks of this script... If you create a file .hushlogin it will not run the mail check... See the if loop...
-Ryan
0
 

Author Comment

by:klukac
ID: 8040826
ryan,

Thanks for your quick reply.  I checked the /.dt/startlogs for my account and the root account, and got these errors:
the root account could not read //.profile, and my account could not read $HOME/.login.  The root account is sh (default Solaris install), but when I created my account, I made it csh as we do most of our accounts.  
I have a .login file, and it reads just like the one you sent me, but for hushlogin it was different, it read
if (! -e .hushlogin ) then
if { /bin/i386 } then
setenv TERM sun-color
else
setenv TERM sun
endif
endif
endif
I changed my .login to coincide with yours, copied it to root as .login and .profile (just to cover all the bases)
Also checked the .dtprofile to make sure that login errors
show up in the console window (I believe this is the line needed):
export dtstart_sessionlogfile="/dev/console"
I tried changing the root shell to csh via the /etc/password file, it didn't take.  Anyway since my vi is not working, I end up changing the file on my PC under a txt extenstion, then I ftp to $HOME and copy it to the right location.  (now I remember to back all files up)
I see no errors in the console window for vi, only 'su' succeeded for klukac, root etc

Thanks,
Christine

0
 

Author Comment

by:klukac
ID: 8041591
Ryan,

I forgot to mention that when I could not locate a root .profile and copied the file you sent to /.login and to .profile, I get a -sh syntax error: 'else' unexpected.  

I know that the sh shell reads .profile which isn't the same as .login, and that there's a procedure for changing the root shell (to csh) which I failed to look up.
I'm lucky this Sparc20's still running. Where are the terminal preferences set?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:ryanf
ID: 8041765
I have a file in /etc called "profile" (notice no leading ".").  In this file I have setup all my default system env settings (Default path, prompt, printer, editor, etc...).  The I have root's account set to sbin/sh.  I do not have  a .profile for root in root's home dir... I get the same "could not read //.profile" in my log also... Shoot me an email address, I will send you my /etc/profile that I use (And have used for some time)...

I am still curious as to what happens when you type vi?  I am used to seeing errors like tmp dir problems, etc...

-Ryan
0
 
LVL 4

Expert Comment

by:besky
ID: 8049094
Some general advice:

There are system loginfiles, /etc/profile and /etc/.login
that is read for every user depending of what shell the user has.
This is where the normal mail-checking takes place, I guess
this is the ones you want to change/remove.

Apart from these, every user can have their own loginfile(s)

Which file is shell specific, .profile or .login ( others for bash, zsh etc.)

These files has to start with a dot "." in order to be read by the shell.

If you are running CDE the first loginfile read is .dtprofile in your homedir. At the end of this file there is a variable DTSOURCEPROFILE that has to be set to TRUE if the users normal loginfiles are to be read ( this is default from S8 )

HTH
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8049427
~/.login and /etc/csh.login are files for csh
~/.profile and /etc/profile are files for sh, ksh (and some more)

If you simply copy .login (csh syntax) to .profile (sh syntax) then your next login will give you erros 'cause of wrong syntax.

You need to provide the correct syntax for each login shell, either sh or csh syntax.

The simplest way to get your vi working again in the current shell is:

   env TERM=vt100 vi

 
0
 

Author Comment

by:klukac
ID: 8057278
Ahoffman, thanks for your comment.  The users on my Solaris are using csh shells, so I typed in:
setenv TERM=vt100 vi
in a terminal window where I was logged on as a csh user  
and the problem with vi is fixed.  

env now shows TERM=vt100 instead of TERM=sun
However everytime I su or reboot I have to setenv again.

ryanf, ahoffman:
I think that /etc/skel local.profile is a Solaris default /backup for the root shell profile.  I copy it below:
# @(#)local.profile 1.8     99/03/26 SMI
stty istrip
PATH=/usr/bin:/usr/ucb:/etc:.
export PATH

#
# If possible, start the windows system
#
if [ "`tty`" = "/dev/console" ] ; then
     if [ "$TERM" = "sun" -o "$TERM" = "sun-color" -o "$TERM" = "AT386" ]
     then

          if [ ${OPENWINHOME:-""} = "" ] ; then
               OPENWINHOME=/usr/openwin
               export OPENWINHOME
          fi

          echo ""
          echo "Starting OpenWindows in 5 seconds (type Control-C to interrupt)"
          sleep 5
          echo ""
          $OPENWINHOME/bin/openwin

          clear          # get rid of annoying cursor rectangle
          exit          # logout after leaving windows system

     fi
fi

I'd like to change it to redefine terminal input.  Similarly, the local.login file for csh users in /etc/skel looks like this:
#ident     "@(#)login.csh     1.7     98/10/03 SMI"

# The initial machine wide defaults for csh.

if ( $?TERM == 0 ) then
     if { /bin/i386 } then
          setenv TERM sun-color
     else
          setenv TERM sun
     endif
else
     if ( $TERM == "" ) then
          if { /bin/i386 } then
               setenv TERM sun-color
          else
               setenv TERM sun
          endif
     endif
endif

if (! -e .hushlogin ) then
if { /bin/i386 } then
setenv TERM sun-color
else
setenv TERM sun
endif
endif
endif

I'd like to change this also, so I don't have to type
setenv TERM vt100 every time I change to a csh user
Ryan I tried finding your email address per your comment, no luck.  

Thanks to all of you,
Christine
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8057515
please re-read my suggestion:
  (local).profile is sh, **not** csh
so it's useless for you
Your friends are local.login (and probably local.cshrc), both to be found in /etc
simply replace sun and/or sun-color to vt100 there for each setenv command

BTW, local.login in your last posting has one endif to much at the end
0
 

Author Comment

by:klukac
ID: 8063619
ahoffman, please re-read my comment: you are the one who's confused!

The problem is fixed now for my (csh) .login files only, I
edited the file to include the line
setenv TERM "vt100"
 
I tried editing the root (sh) at /etc/profile per hoffman's suggestion, and I get a response if the syntax is incorrect
( env TERM=vt100 vi works neither in the file nor at the command line ) but when the syntax is correct (TERM=vt100) it doesn't change the env variables.

root inherits the env variables that I had when logged on to the previous account, immediately before su -
(not sure why)

ryan, my email is klukac@ppc.pims.org - if you send me your /etc/profile, maybe that'll work

Thanks,
Christine
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8063677
hmm, you should get used to shells, probably reading a book or man pages, somehow ...

> env TERM=vt100 vi
is an interactive command, beside it's not working in files/scripts, it doesn't  make any sense there

> I tried editing the root (sh) at /etc/profile ..
why would you do that?
if you use csh, it's never consulted anyhow.

> root inherits the env variables ..
for shure, probably your root account uses sh, not csh as other users. Have you checked?

> root inherits the env variables that I had when logged on to the previous account, ..
then you did su not su -

BTW, keep in mind that csh behaves different compared to sh for interactive shell and interactive login shell.
Please read man csh about this (it's far toooo much to explain here).

I'm confused about your doing, not your comments (assuming that your comments reflect what you've done;-)

If you're not used to the suggestions given here, you better ask about it, instead of guessing how to use it to fit your requirements.

Please post exactly/verbatime what you type in your shell, and what is the response there. Makes things much easyer.
Also make shure which shell you're currently using, just do a simple:
  echo $SHELL
before
0
 
LVL 2

Expert Comment

by:ryanf
ID: 8064080
Sent you an email with the profile.  Not sure if it will help, but you may be able to pull some  info... it is for SH, and KSH users, but root's shell should be SH anyway IMO...

Still not sure exactly what your error is with VI?  I am curious as to exactly what problem we are trying to solve?

-Ryan
0
 

Author Comment

by:klukac
ID: 8080128
I was using su - , but got strange results as you know.  In the end, I restored all the system defaults, left the change to setenv TERM vt100 for the .csh login files, and rebooted.  It's working now, so I'll close the ticket.
0
 
LVL 18

Expert Comment

by:liddler
ID: 10425994


No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ and refund

Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

liddler
EE Cleanup Volunteer

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10427549
disagree, all my comments give hints and solutions
It's not my fault that the questioner did not read carefully, and finally re-installed rhe system to fix (his/her) configuration errors

I don't insist on a grading, but please no refund 'cause there a valid suggestions
0
 

Accepted Solution

by:
amp072397 earned 400 total points
ID: 10464724
PAQed, with points refunded (100)

amp
Community Support Moderator amp~at~experts-exchange.com
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10467841
amp, why did you PAQ with refund?
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question