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.

2
  • Please add the output of ls -hl /bin/bash to your question.
    – user46953
    Commented Jan 13, 2017 at 17:20
  • pi@raspberrypi:~ $ ls -hl /bin/bash -rwxr-xr-x 1 root root 844K Oct 18 2014 /bin/bash Commented Jan 14, 2017 at 12:28

4 Answers 4

2

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

@reboot SHELL=/bin/bash vncserver
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.

3

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

export SHELL=/bin/bash
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

1
  • My default shell is already /bin/bash. But when I open a terminal in a VNC session, I just get /bin/sh. Commented Jan 13, 2017 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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