Shell Variables
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.
You can also view it by using the man command and searching for Shell Variables
.
man bash
/Shell Variables
Common Variables
PS1
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\]\$
UID
Current user ID.
echo $UID
1000
PPID
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.
BASH_VERSION
echo $BASH_VERSION
5.1.16(1)-release
BASH_SUBSHELL
Subshell nesting level, starting from 0.
echo $BASH_SUBSHELL
0
SECONDS
Seconds since the shell started.
echo $SECONDS
13963
RANDOM
0 ~ 32767 random number.
echo $RANDOM
1024
No comments to display
No comments to display