Linux シェル変数コマンド
set
set BASH=/bin/bash BASH_ARGC=() BASH_ARGV=() BASH_LINENO=() BASH_REMATCH=([0]="z") BASH_SOURCE=() BASH_VERSINFO=([0]="3" [1]="2" [2]="57" [3]="1" [4]="release" [5]="x86_64-apple-darwin19") BASH_VERSION='3.2.57(1)-release' COLUMNS=145 CPPFLAGS=-I/usr/local/opt/openssl@1.1/include DIRSTACK=() EUID=501 GROUPS=() HISTFILE=/Users/kaede/.bash_sessions/5731033B-FE81-4488-9C44-85C77EDA7002.historynew HISTFILESIZE=500 HISTSIZE=500 HOME=/Users/kaede
シェルに入っている変数を全部表示する
env
env MANPATH=/opt/local/man:/opt/local/man: LDFLAGS=-L/usr/local/opt/openssl@1.1/lib TERM_PROGRAM=Apple_Terminal TERM=xterm-256color SHELL=/bin/bash USER=kaede PWD=/Users/kaede/code/temp/fileOperate/xz PATH=/Users/kaede/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/usr/local/opt/libiconv/bin:/............. HOME=/Users/kaede
シェル変数の中の環境変数を出力する
PWD, SHELL, USER, PATH, などが見れる
printenv
env より表示される数が少ない?
printenv MANPATH=/opt/local/man:/opt/local/man: LDFLAGS=-L/usr/local/opt/openssl@1.1/lib TERM_PROGRAM=Apple_Terminal TERM=xterm-256color SHELL=/bin/bash PWD=/Users/kaede/code/temp/fileOperate/xz XPC_FLAGS=0x0 RBENV_SHELL=bash XPC_SERVICE_NAME=0 HOME=/Users/kaede SHLVL=1 LOGNAME=kaede LC_CTYPE=UTF-8