LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Ksh .profile not read on login under Gnome desktop (https://www.linuxquestions.org/questions/linux-software-2/ksh-profile-not-read-on-login-under-gnome-desktop-898755/)

danie1 08-22-2011 07:48 AM

Ksh .profile not read on login under Gnome desktop
 
I downloaded ksh for Debian and set up a .profile, but when I execute a terminal window under Gnome it fails to read the .profile or .kshrc. I experimented some with gnome-terminal options, but could not get it to read the files. I can execute the files manually ok. My user shell says ksh but the files are not read. Any suggestions appreciated. Thanks.

tronayne 08-22-2011 09:33 AM

Did you change the shell in /etc/passwd? The password entry needs to look like
Code:

userid:x:1000:100:fname lname,,,:/home/userid:/bin/ksh
Also, you need to log out (or better yet reboot if you use graphical log in window) so things actually get read.

Just in case you're not familiar with Korn Shell, your .kshrc gets read by .profile with something similar to this
Code:

#      set up the ksh environment                                                                 
ENV=${HOME}/.kshrc                                                                                 
export ENV

Hope this helps some.

danie1 08-23-2011 07:23 AM

I'm a retired admin. Used Korn for years (don't actually like bash). Yes, I did all that.

Linux 2.6.26-2-686:</home/dan[rufus]$echo $SHELL
/usr/bin/ksh
Linux 2.6.26-2-686:</home/dan[rufus]$echo $ENV
/home/dan/.kshrc
Linux 2.6.26-2-686:</home/dan[rufus]$. ./.profile

Linux 2.6.26-2-686:</home/dan>
[rufus]$grep dan /etc/passwd
dan:x:1000:1000:dan,,,:/home/dan:/usr/bin/ksh

Linux 2.6.26-2-686:</home/dan>
[rufus]$

tronayne 08-24-2011 08:52 AM

I don't know specifically about GNOME (don't like it or BASH either, too) but here's a thought.

KDE has two terminal utilities, one, a terminal emulator (/usr/bin/terminal), does not execute ~/.profile (just give a $ prompt); the other, /usr/bin/konsole, does execute ~/.profile.

Anything like that in GNOME?

Hope this helps some.

By the way, does Debian support /etc/profile.d (with environment setup files)? Although this has nothing to do with the problem, I add a couple of files to /etc/profile.d for setting environment variables and things so I don't have to monkey with /etc/profile or my home .profile (well, except for .kshrc anyway). The one I use for Korn Shell may be of interest (assuming the existence of /etc/profile.d, that is):
Code:

cat /etc/profile.d/ksh.sh
#!/bin/sh
#ident  "$Id$"
#
#      Name:          $Source$
#      Version:        $Revision$
#      Modified:      $Date$
#      Purpose:        set local environment variables for Korn Shell
#      Author:        T. N. Ronayne
#      Date:          1 Oct 2009
#      $Log$
# Set the HOST environment variable
export HOST="`uname -n`"
# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
#  VISUAL=emacs        # ugh
#  VISUAL=gmacs        # double ugh
  VISUAL=vi            # ah, elegence
fi
# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
# Do these anyway in case sombody uses a different shell                                           
if [ "$SHELL" = "/bin/pdksh" ]; then                                                               
 PS1='! $ '                                                                                       
elif [ "$SHELL" = "/bin/ksh" ]; then                                                               
 PS1='${HOST}-${USER}-${PWD}: '                                                                   
elif [ "$SHELL" = "/bin/zsh" ]; then                                                               
 PS1='%n@%m:%~%# '                                                                                 
elif [ "$SHELL" = "/bin/ash" ]; then                                                               
 PS1='$ '                                                                                         
else                                                                                               
 PS1='\u@\h:\w\$ '                                                                                 
fi                                                                                                 
PS2='> '                                                                                           
export PS1 PS2

Maybe useful, maybe not.

tronayne 08-26-2011 03:40 PM

Had a thought -- have you tried just running xterm? That ought to read /etc/profile for you.

danie1 08-29-2011 04:08 PM

Actually I noticed that and *thought* I posted a comment about it a few days ago. There is not profile.d but there is an xterm. So I imported some options from a script I used to use and tried: xterm -ls -geometry 140x40 -sb -rightbar -bg gray -fg black -title "[hostname]:~dan" -iconic -n "[hostname]:~dan"

This kind of works. It may be too many options, since it won't start as iconic, but everything else seems to work. The ls option causes it to read the profile.


All times are GMT -5. The time now is 12:27 AM.