Bash 매뉴얼에 따르면 로그인 쉘만 로드됩니다./etc/구성 파일문서.
Bash가 --login 옵션을 사용하여 대화형 로그인 셸 또는 비대화형 셸로 호출되면 먼저 /etc/profile 파일(파일이 있는 경우)에서 명령을 읽고 실행합니다.
명시적으로 로드하지 않았습니다./etc/구성 파일문서.
로그인이 아닌 대화형 셸을 사용하지만 다음에 정의된 환경 변수에 계속 액세스할 수 있는 이유가 궁금합니다./etc/구성 파일문서?
# current shell PID
[root@kafka100 cpp]# echo $$
1829
# indicates non-login shell
[root@kafka100 cpp]# shopt | grep login
login_shell off
# JAVA_HOME was defined in /etc/profile
[root@kafka100 cpp]# echo $JAVA_HOME
/usr/local/src/jdk1.8.0_333
프로세스 트리는 다음과 같습니다.
[root@kafka100 cpp]# ps xjf
PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND
1 1017 1017 1017 ? -1 Ss 0 0:00 /usr/sbin/sshd -D
1017 1109 1109 1109 ? -1 Ss 0 0:00 \_ sshd: root@notty
1109 1535 1535 1535 ? -1 Ss 0 0:00 \_ bash
1535 1582 1535 1535 ? -1 S 0 0:00 \_ sh /root/.vscode-server/bin/30d9c6cd9483b2cc586687151bcbcd635f373630/bin/code-server --start-server --host=127.0.0.1 --accept-server-license-terms --enable-remote-auto-shutdown --port=0 --telemetry-level all --connection-token-file /root/.vscode-server/.30d9c6cd9483b2cc586687151bcbcd635f373630.token
1582 1594 1535 1535 ? -1 Rl 0 0:03 | \_ /root/.vscode-server/bin/30d9c6cd9483b2cc586687151bcbcd635f373630/node /root/.vscode-server/bin/30d9c6cd9483b2cc586687151bcbcd635f373630/out/server-main.js --start-server --host=127.0.0.1 --accept-server-license-terms --enable-remote-auto-shutdown --port=0 --telemetry-level all --connection-token-file /root/.vscode-server/.30d9c6cd9483b2cc586687151bcbcd635f373630.token
1594 1644 1535 1535 ? -1 Sl 0 0:03 | \_ /root/.vscode-server/bin/30d9c6cd9483b2cc586687151bcbcd635f373630/node /root/.vscode-server/bin/30d9c6cd9483b2cc586687151bcbcd635f373630/out/bootstrap-fork --type=ptyHost
1644 1829 1829 1829 pts/1 2407 Ss 0 0:00 | | \_ /usr/bin/bash
[root@kafka100 cpp]# cat /proc/1644/environ | tr '\0' '\n'
XDG_SESSION_ID=1
SELINUX_ROLE_REQUESTED=
SHELL=/bin/bash
SSH_CLIENT=192.168.44.1 51182 22
SELINUX_USE_CURRENT_RANGE=
USER=root
VSCODE_AGENT_FOLDER=/root/.vscode-server
MAIL=/var/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
PWD=/root
LANG=en_US.UTF-8
SELINUX_LEVEL_REQUESTED=
SHLVL=3
HOME=/root
LOGNAME=root
SSH_CONNECTION=192.168.44.1 51182 192.168.44.100 22
LESSOPEN=||/usr/bin/lesspipe.sh %s
XDG_RUNTIME_DIR=/run/user/0
_=/root/.vscode-server/bin/30d9c6cd9483b2cc586687151bcbcd635f373630/node
VSCODE_HANDLES_SIGPIPE=true
VSCODE_PARENT_PID=1594
VSCODE_LAST_PTY_ID=0
VSCODE_AMD_ENTRYPOINT=vs/platform/terminal/node/ptyHostMain
VSCODE_PIPE_LOGGING=true
VSCODE_VERBOSE_LOGGING=true
VSCODE_RECONNECT_GRACE_TIME=10800000
VSCODE_RECONNECT_SHORT_GRACE_TIME=300000
VSCODE_RECONNECT_SCROLLBACK=100
NODE_CHANNEL_FD=3
NODE_CHANNEL_SERIALIZATION_MODE=json
[root@kafka100 cpp]# cat /proc/1829/environ | tr '\0' '\n'
XDG_SESSION_ID=1
SHELL=/bin/bash
SSH_CLIENT=192.168.44.1 51182 22
USER=root
MAIL=/var/spool/mail/root
PATH=/root/.vscode-server/bin/30d9c6cd9483b2cc586687151bcbcd635f373630/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/src/jdk1.8.0_333/bin:/usr/local/src/kafka_2.12-3.3.1/bin:/usr/local/src/cmake-3.23.0-linux-x86_64/bin:/root/bin
PWD=/root/workspace/cpp
LANG=en_US.UTF-8
SHLVL=4
HOME=/root
LOGNAME=root
SSH_CONNECTION=192.168.44.1 51182 192.168.44.100 22
LESSOPEN=||/usr/bin/lesspipe.sh %s
XDG_RUNTIME_DIR=/run/user/0
_=/root/.vscode-server/bin/30d9c6cd9483b2cc586687151bcbcd635f373630/node
KAFKA_HOME=/usr/local/src/kafka_2.12-3.3.1
HOSTNAME=kafka100
HISTSIZE=1000
CMAKE_HOME=/usr/local/src/cmake-3.23.0-linux-x86_64
JAVA_HOME=/usr/local/src/jdk1.8.0_333
HISTCONTROL=ignoredups
BROWSER=/root/.vscode-server/bin/30d9c6cd9483b2cc586687151bcbcd635f373630/bin/helpers/browser.sh
TERM_PROGRAM=vscode
TERM_PROGRAM_VERSION=1.68.1
COLORTERM=truecolor
VSCODE_IPC_HOOK_CLI=/run/user/0/vscode-ipc-5aa8f760-55f0-41a9-9077-f078504d0176.sock
TERM=xterm-256color