4

When I open a terminal (e.g. lxsession or xterm) in LXDE which is running in a VNC session the shell is

$ echo $SHELL
/bin/sh

However, I want my default shell which is /bin/bash to use my .bashrc file.

How can I get it?

The problem seems related to the fact that I start VNC at boot time via my crontab entry

@reboot vncserver &

If I start another VNC session from a shell I have a Bash shell as expected in this VNC session. Of course at login via SSH I get a Bash, too.

Frank Breitling
  • 1,009
  • 1
  • 15
  • 30

4 Answers4

5

It seems like the problem originates form cron using /bin/sh and not the users SHELL default. I found other people having the same problem at

As a result /bin/sh is the default SHELL when VNC is started by cron.

My solution is to start my vncserver by cron through a script in which I export the SHELL variable first like this:

#!/bin/bash
export SHELL=/bin/bash
vncserver

This solves the problem.

Frank Breitling
  • 1,009
  • 1
  • 15
  • 30
3

I was able to fix the issue by adding following line in my ~/.vnc/xstartup :

export SHELL=/bin/bash
Tymek
  • 131
  • 2
2

I have solved the issue by passing SHELL variable inline inside a cron entry:

@reboot SHELL=/bin/bash vncserver
Asmoox
  • 136
  • 2
2

AFAIK the default login shell is used even in lxterminal.

You can check what your default is by looking at the /etc/passwd file for you user e.g. cat /etc/passwd | grep pi for most Pi users.

If you wish to change your login shell use the chsh command.

NOTE /bin/sh is a symlink to the default system shell; normally /etc/dash and should not be changed

Milliways
  • 62,573
  • 32
  • 113
  • 225