Published Book on Amazon
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1 | |
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2 |
출판된 한글판 도서
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상) | |
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하) |
Original Book Contents
8.2.2 Specifying Default Shell Program
There are various Shell programs available in Linux, and other Shell programs may be provided depending on the distribution. If you have other Shell programs you need, you can also use the Shell program.
On Linux, information about the Shell program currently installed on the system is stored in the "/etc/shells" file. If you check the information just like below, you can see that you can use various Shell programs. One of these several Shell programs installed in the system is specified as the Shell program used by default in the system.
pi@raspberrypi ~ $ cat /etc/shells |
# /etc/shells: valid login shells /bin/sh /bin/dash /bin/bash /bin/rbash |
The default Shell program is a Shell program that is always executed if there is no special designation. The environment variable $SHELL tells you what Shell programs are used by default on your system.
First, let's look at the environment variable $SHELL specified in the system.
pi@raspberrypi ~ $ echo $SHELL |
/bin/bash |
The environment variable is specified as "/bin/bash". This means that if you run a Shell command on your system, the system will find a Shell program that will process the command, and it will always use the program in "/bin/bash".
If users want to use another Shell program, he can install it on the system and change the value of this environment variable to that Shell program. See the description of the section [10.2.2 Environment Variable] for details on how to change environment variables.
You can change the environment variable to the desired value by using "export" command as follows.
export SHELL="/bin/ksh" |
If you check the value of the environment variable again then, you can see that the value has changed.
pi@raspberrypi ~ $ echo $SHELL |
/bin/ksh |