Shell variables#

Display of all shell variables#

[1]:
!set
…
HOME=/Users/veit
…
PATH=/Users/veit/.local/share/virtualenvs/python-311-6zxVKbDJ/bin:/opt/homebrew/Cellar/pipenv/2023.6.18/libexec/tools:/Users/veit/spack/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
…

Showing the value of a variable#

[2]:
!echo $HOME
/Users/veit

The path variable#

It defines the shell’s search path, i.e., the list of directories that the shell looks in for runnable programs.

[3]:
!echo $PATH
/Users/veit/.local/share/virtualenvs/python-311-6zxVKbDJ/bin:/opt/homebrew/Cellar/pipenv/2023.6.18/libexec/tools:/Users/veit/spack/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin

Creating and changing variables#

Creating or overwriting variables#

[4]:
!export SPACK_ROOT=~/spack

Append additional specifications#

[5]:
!export PATH=/usr/local/opt/python@3.7/bin:$PATH