Solved Problem to display proper prompt in a terminal with sh

I'm in FreeBSD 13.1 and if I login from the console and enter startx, the prompt in the terminal emulators works fine and displays username@hostname:directory $, but if I use Slim to login the prompt in the terminal emulators only displays $ no matter what folder I am, if I source the shell . .shrc it fixes this, but when I close the terminal and open it again it's back to only $.
Is there a way I can fix this, and login through Slim and have a prompt in terminal emulators with username@hostname:directory $?
Thanks in advance!
 
Which terminal are you using? Most will allow you to enable a "login" shell. Shells use different start scripts based on how they're started, there's a difference between 'interactive' and 'login' shells for example. See the manual page of the shell you're using.
 
Which terminal are you using? Most will allow you to enable a "login" shell. Shells use different start scripts based on how they're started, there's a difference between 'interactive' and 'login' shells for example. See the manual page of the shell you're using.
It doesn't matter which terminal I use, I have tried with xterm and lxterminal, and its the same behavior.

What is the shell of the user as configured in /etc/password ?
You mean /etc/passwd?, if so, for my user its /bin/sh
 
If I recall Slim doesn't source the user's profile script correctly.

In your .xsession file, just add the . .shrc

Slim does a lot of things wrong. You might need to modify the .xinitrc file rather than .xsession since I have a suspicion it uses that instead.
 
If I recall Slim doesn't source the user's profile script correctly.

In your .xsession file, just add the . .shrc

Slim does a lot of things wrong. You might need to modify the .xinitrc file rather than .xsession since I have a suspicion it uses that instead.
I don't have a .xsession so I added to .xinitrc before exec openbox-session, still the same
 
In your .xsession file, just add the . .shrc
I don't have a .xsession so I added to .xinitrc before exec openbox-session, still the same

Apply the environment variable from ~/.profile:
Code:
# set ENV to a file invoked each time sh is started for interactive use.
ENV=$HOME/.shrc; export ENV
in ~/.xinitrc (shorter form):
Code:
export ENV=$HOME/.shrc

~/.xinitrc is executed by slim after a successful login:

/usr/local/etc/slim.conf
Code:
# This command is executed after a succesful login.
# you can place the %session and %theme variables
# to handle launching of specific commands in .xinitrc
# depending of chosen session and slim theme
#
# NOTE: if your system does not have bash you need
# to adjust the command according to your preferred shell,
# i.e. for freebsd use:
login_cmd           exec /bin/sh - ~/.xinitrc %session
 
Why use a X display manager that has not been active since 2013?

Why not use one that is active developed like x11/lightdm if you really want a graphical login?
I prefer to login from console and after that Xorg starts automatically.
e.g.
.zshrc:
Code:
 if [ $( /usr/bin/tty ) = "/dev/ttyv0" ]; then
        startx
    logout
 fi
I know it's not actively developed, but I like the simplicity of SLiM, maybe I consider another display manager or try your suggestion to auto start Xorg, thanks.
 
Apply the environment variable from ~/.profile:
Code:
# set ENV to a file invoked each time sh is started for interactive use.
ENV=$HOME/.shrc; export ENV
in ~/.xinitrc (shorter form):
Code:
export ENV=$HOME/.shrc

~/.xinitrc is executed by slim after a successful login:

/usr/local/etc/slim.conf
Code:
# This command is executed after a succesful login.
# you can place the %session and %theme variables
# to handle launching of specific commands in .xinitrc
# depending of chosen session and slim theme
#
# NOTE: if your system does not have bash you need
# to adjust the command according to your preferred shell,
# i.e. for freebsd use:
login_cmd           exec /bin/sh - ~/.xinitrc %session
Applying the environment variable in .xinitrc, it's working, thanks!
 
That is not what Sir Dice asked, the idea was to make terminal open a login shell, e.g. for xterm it's xterm -ls or XTerm*loginShell: true in .Xresources.
Thanks for clarifying that, I tried that way and it also works.

Thanks everyone, now I have some different options to try and decide.

This can now be marked as Solved by a moderator, thanks.
 
Back
Top