Title here
Summary here
Shell variables are a general term. If you are using a specific shell, such as Bash, you can call it a Bash variable. But it is important to note that shell variables are not environment variables, do not be confused by their capitalization, here are the relevant official documents.
gun.org
gun.org
You can also view it by using the man command and searching for Shell Variables
.
man bash
/Shell Variables
Shell command prompt.
echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
Current user ID.
echo $UID
1000
ps -fp $PPID
UID PID PPID C STIME TTY TIME CMD
kuga 46635 46570 0 10:56 ? 00:00:00 sshd: kuga@pts/0
You can see that the parent process of bash is sshd.
echo $BASH_VERSION
5.1.16(1)-release
Subshell nesting level, starting from 0.
echo $BASH_SUBSHELL
0
Seconds since the shell started.
echo $SECONDS
13963
0 ~ 32767 random number.
echo $RANDOM
1024
Refer to the later chapter on environment variables