Os - Shell in Linux context
The valid shell for a distribution are listed in the /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/ksh
Several type of wiki/unix_shell have been developed:
The following table shows the commonly used default UNIX® system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.
Shell | Prompt |
---|---|
C shell | machine_name% |
C shell for superuser | machine_name# |
Bourne shell and Korn shell | $ |
Bourne shell and Korn shell for superuser | # |
echo $SHELL
/bin/bash
ps -p $$
PID TTY TIME CMD
4104 pts/1 00:00:00 bash
where:
Then running a ps on that number displays a process status listing of your shell.
In bash, the special parameter 0 expands to the name of the shell or shell script. This is set at shell initialization. If bash is invoked with a file of com- mands, $0 is set to the name of that file.
If bash is started with the -c option, then $0 is set to the first argument after the string to be executed, if one is present. Otherwise, it is set to the file name used to invoke bash, as given by argument zero.
# echo $0
/bin/bash
The utility chsh (Change the login shell) is used to change it.
It will change it in the /etc/password file
See the special parameter $_
The following startup files 1) are sourced when the shell is
When the shell:
A executable bash script is non-interactive.
A login shell is just an option that will execute scripts at login (start) and end (logout) time. See What is a Login Shell?
The entrypoint is a:
A bash instance within a Docker exec command will be:
Example:
docker exec -ti containerName bash
docker exec -ti containerName bash -l