How terminal in Jupyter automatically starts bash instead of sh

I like the terminal function and works very well for our use case when I would like students to do some work directly from the terminal so that they can experience this environment. The shell that starts automatically is sh and does not display all of my default bash values. I can print "bash" and everything works fine. How can I make "bash" by default?

+5
source share
3 answers

Jupyter uses the $SHELL environment variable to decide which shell to run. If you run jupyter using init, this will be configured to dash on Ubuntu systems. My solution is export SHELL=/bin/bash in a script running jupyter.

+5
source

When Jupyter runs on Ubuntu 15.10, the Jupyter shell will default to / bin / sh, which is a symbolic link to / bin / dash.

 rm /bin/sh ln -s /bin/bash /bin/sh 

This fix triggered loading Jupyter in bash for me.

+1
source

I tried the final way to switch the SHELL system-wide environment variable by adding the following line to the / etc / environment file:

  SHELL=/bin/bash 

This works in an Ubuntu environment. From time to time, the SHELL variable always points to / bin / bash instead of / bin / sh in the terminal after a reboot.

In addition, when starting the jupyter notebook system when starting the system, setting up the CRON job triggered the same problem on the jupyter notebook terminal.

It turned out that I needed to include the variable operators and source definitions for the Bash initialization file of type ~ / .bashrc in the CRON job instructions as follows: $ crontab -e command:

  @reboot source /home/USERNAME/.bashrc && \ export SHELL=/bin/bash && \ /SOMEWHERE/jupyter notebook --port=8888 

This way, I can log in to the Ubuntu server through a remote web browser ( http: // server-ip-address: 8888 / ) with the jupyter opening the terminal for the default laptop for Bash in the same way as the local environment.

+1
source

Source: https://habr.com/ru/post/1234974/


All Articles