1

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.

  • Please add the output of ls -hl /bin/bash to your question. – David Cullen Jan 13 '17 at 17:20
  • pi@raspberrypi:~ $ ls -hl /bin/bash -rwxr-xr-x 1 root root 844K Oct 18 2014 /bin/bash – Frank Breitling Jan 14 '17 at 12:28
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

  • My default shell is already /bin/bash. But when I open a terminal in a VNC session, I just get /bin/sh. – Frank Breitling Jan 13 '17 at 15:49
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.