{ "cells": [ { "cell_type": "markdown", "id": "detected-assault", "metadata": {}, "source": [ "# Shell variables" ] }, { "cell_type": "markdown", "id": "b7bce137", "metadata": {}, "source": [ "## Display of all shell variables" ] }, { "cell_type": "code", "execution_count": 1, "id": "civic-porcelain", "metadata": { "execution": { "iopub.execute_input": "2026-05-20T17:59:16.306108Z", "iopub.status.busy": "2026-05-20T17:59:16.305936Z", "iopub.status.idle": "2026-05-20T17:59:16.434541Z", "shell.execute_reply": "2026-05-20T17:59:16.433946Z", "shell.execute_reply.started": "2026-05-20T17:59:16.306091Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "!=0\n", "'#'=0\n", "'$'=29997\n", "'*'=( )\n", "-=569X\n", "0=/bin/zsh\n", "'?'=0\n", "@=( )\n", "ARGC=0\n", "CDPATH=''\n", "CLICOLOR=1\n", "CLICOLOR_FORCE=1\n", "COLUMNS=80\n", "CPPFLAGS=-I/opt/homebrew/opt/libomp/include\n", "CPUTYPE=arm64\n", "EGID=20\n", "EUID=501\n", "FIGNORE=''\n", "FORCE_COLOR=1\n", "FPATH=/opt/homebrew/share/zsh/site-functions:/usr/local/share/zsh/site-functions:/usr/share/zsh/site-functions:/usr/share/zsh/5.9/functions:/Users/veit/.zfunc\n", "FUNCNEST=700\n", "GID=20\n", "GIT_PAGER=cat\n", "HISTCHARS='!^#'\n", "HISTCMD=0\n", "HISTSIZE=30\n", "HOME=/Users/veit\n", "HOMEBREW_CELLAR=/opt/homebrew/Cellar\n", "HOMEBREW_NO_ANALYTICS=1\n", "HOMEBREW_PREFIX=/opt/homebrew\n", "HOMEBREW_REPOSITORY=/opt/homebrew\n", "HOST=fay.local\n", "IFS=$' \\t\\n\\C-@'\n", "INFOPATH=/opt/homebrew/share/info:\n", "JPY_PARENT_PID=92198\n", "JPY_SESSION_NAME=/Users/veit/cusy/trn/Python4DataScience/docs/workspace/ipython/unix-shell/shell-variables.ipynb\n", "KEYBOARD_HACK=''\n", "KEYTIMEOUT=40\n", "LC_CTYPE=UTF-8\n", "LDFLAGS=-L/opt/homebrew/opt/libomp/lib\n", "LINENO=1\n", "LINES=24\n", "LISTMAX=100\n", "LOGNAME=veit\n", "LaunchInstanceID=3B58B71F-E402-40DE-883C-664B9838C83A\n", "MACHTYPE=x86_64\n", "MAILCHECK=60\n", "MAILPATH=''\n", "MANPATH=''\n", "MODULE_PATH=/usr/lib/zsh/5.9\n", "MPLBACKEND=module://matplotlib_inline.backend_inline\n", "NULLCMD=cat\n", "OLDPWD=/Users/veit/cusy/trn/Python4DataScience/docs/workspace/ipython/unix-shell\n", "OPTARG=''\n", "OPTIND=1\n", "OSTYPE=darwin24.0\n", "PAGER=cat\n", "PATH=/Users/veit/cusy/trn/Python4DataScience/.venv/bin:/Users/veit/.local/bin:/Users/veit/.cargo/bin:/Users/veit/spack/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew//lib/ruby/gems/3.3.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/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:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/Library/TeX/texbin:/Users/veit/.lmstudio/bin\n", "PPID=29994\n", "PROMPT=''\n", "PROMPT2=''\n", "PROMPT3='?# '\n", "PROMPT4='+%N:%i> '\n", "PS1=''\n", "PS2=''\n", "PS3='?# '\n", "PS4='+%N:%i> '\n", "PSVAR=''\n", "PWD=/Users/veit/cusy/trn/Python4DataScience/docs/workspace/ipython/unix-shell\n", "PYDEVD_USE_FRAME_EVAL=NO\n", "RANDOM=25357\n", "READNULLCMD=more\n", "SAVEHIST=0\n", "SECONDS=0\n", "SECURITYSESSIONID=186b1\n", "SHELL=/bin/zsh\n", "SHLVL=2\n", "SPACK_PYTHON=/opt/homebrew/bin/python3\n", "SPACK_ROOT=/Users/veit/spack\n", "SPROMPT='zsh: correct '\\''%R'\\'' to '\\''%r'\\'' [nyae]? '\n", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.YA3uoh9GcT/Listeners\n", "TERM=xterm-color\n", "TERM_PROGRAM=Apple_Terminal\n", "TERM_PROGRAM_VERSION=455.1\n", "TERM_SESSION_ID=91C8B4C6-9710-438B-BB3A-7AFFCDE0F900\n", "TIMEFMT='%J %U user %S system %P cpu %*E total'\n", "TMPDIR=/var/folders/hk/s8m0bblj0g10hw885gld52mc0000gn/T/\n", "TMPPREFIX=/tmp/zsh\n", "TRY_BLOCK_ERROR=-1\n", "TRY_BLOCK_INTERRUPT=-1\n", "TTY=/dev/ttys098\n", "TTYIDLE=0\n", "UID=501\n", "USER=veit\n", "USERNAME=veit\n", "UV=/Users/veit/.local/bin/uv\n", "UV_RUN_RECURSION_DEPTH=1\n", "VENDOR=apple\n", "VIRTUAL_ENV=/Users/veit/cusy/trn/Python4DataScience/.venv\n", "WATCH\n", "WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>'\n", "XPC_FLAGS=0x0\n", "XPC_SERVICE_NAME=0\n", "ZSH_ARGZERO=/bin/zsh\n", "ZSH_EVAL_CONTEXT=cmdarg\n", "ZSH_EXECUTION_STRING=set\n", "ZSH_NAME=zsh\n", "ZSH_PATCHLEVEL=zsh-5.9-0-g73d3173\n", "ZSH_SUBSHELL=0\n", "ZSH_VERSION=5.9\n", "_=set\n", "__CFBundleIdentifier=com.apple.Terminal\n", "__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0\n", "aliases\n", "argv=( )\n", "builtins\n", "cdpath=( )\n", "commands\n", "dirstack\n", "dis_aliases\n", "dis_builtins\n", "dis_functions\n", "dis_functions_source\n", "dis_galiases\n", "dis_patchars\n", "dis_reswords\n", "dis_saliases\n", "fignore=( )\n", "fpath=( /opt/homebrew/share/zsh/site-functions /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.9/functions /Users/veit/.zfunc )\n", "funcfiletrace\n", "funcsourcetrace\n", "funcstack\n", "functions\n", "functions_source\n", "functrace\n", "galiases\n", "histchars='!^#'\n", "history\n", "historywords\n", "jobdirs\n", "jobstates\n", "jobtexts\n", "keymaps\n", "mailpath=( )\n", "manpath=( )\n", "module_path=( /usr/lib/zsh/5.9 )\n", "modules\n", "nameddirs\n", "options\n", "parameters\n", "patchars\n", "path=( /Users/veit/cusy/trn/Python4DataScience/.venv/bin /Users/veit/.local/bin /Users/veit/.cargo/bin /Users/veit/spack/bin /opt/homebrew/opt/ruby/bin /opt/homebrew//lib/ruby/gems/3.3.0/bin /opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /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 /Library/Apple/usr/bin /usr/local/MacGPG2/bin /Library/TeX/texbin /Users/veit/.lmstudio/bin )\n", "pipestatus=( )\n", "prompt=''\n", "psvar=( )\n", "reswords\n", "saliases\n", "signals=( EXIT HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2 ZERR DEBUG )\n", "status=0\n", "termcap\n", "terminfo\n", "userdirs\n", "usergroups\n", "watch\n", "widgets\n", "zsh_eval_context=( cmdarg )\n", "zsh_scheduled_events\n" ] } ], "source": [ "!set" ] }, { "cell_type": "markdown", "id": "modified-eagle", "metadata": {}, "source": [ "## Showing the value of a variable" ] }, { "cell_type": "code", "execution_count": 2, "id": "focused-pastor", "metadata": { "execution": { "iopub.execute_input": "2026-05-20T17:59:16.435466Z", "iopub.status.busy": "2026-05-20T17:59:16.435285Z", "iopub.status.idle": "2026-05-20T17:59:16.563027Z", "shell.execute_reply": "2026-05-20T17:59:16.562119Z", "shell.execute_reply.started": "2026-05-20T17:59:16.435444Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/Users/veit\n" ] } ], "source": [ "!echo $HOME" ] }, { "cell_type": "markdown", "id": "valued-coach", "metadata": {}, "source": [ "## The `path` variable\n", "\n", "It defines the shell’s search path, i.e., the list of directories that the shell looks in for runnable programs." ] }, { "cell_type": "code", "execution_count": 3, "id": "victorian-consensus", "metadata": { "execution": { "iopub.execute_input": "2026-05-20T17:59:16.564494Z", "iopub.status.busy": "2026-05-20T17:59:16.564245Z", "iopub.status.idle": "2026-05-20T17:59:16.690874Z", "shell.execute_reply": "2026-05-20T17:59:16.689923Z", "shell.execute_reply.started": "2026-05-20T17:59:16.564472Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/Users/veit/cusy/trn/Python4DataScience/.venv/bin:/Users/veit/.local/bin:/Users/veit/.cargo/bin:/Users/veit/spack/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew//lib/ruby/gems/3.3.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/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:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/Library/TeX/texbin:/Users/veit/.lmstudio/bin\n" ] } ], "source": [ "!echo $PATH" ] }, { "cell_type": "markdown", "id": "personal-stream", "metadata": {}, "source": [ "## Creating and changing variables" ] }, { "cell_type": "markdown", "id": "sweet-function", "metadata": {}, "source": [ "### Creating or overwriting variables" ] }, { "cell_type": "code", "execution_count": 4, "id": "abandoned-reservation", "metadata": { "execution": { "iopub.execute_input": "2026-05-20T17:59:16.692570Z", "iopub.status.busy": "2026-05-20T17:59:16.692110Z", "iopub.status.idle": "2026-05-20T17:59:16.818652Z", "shell.execute_reply": "2026-05-20T17:59:16.817922Z", "shell.execute_reply.started": "2026-05-20T17:59:16.692547Z" } }, "outputs": [], "source": [ "!export SPACK_ROOT=~/spack" ] }, { "cell_type": "markdown", "id": "varying-muscle", "metadata": {}, "source": [ "### Append additional specifications" ] }, { "cell_type": "code", "execution_count": 5, "id": "premier-career", "metadata": { "execution": { "iopub.execute_input": "2026-05-20T17:59:16.819820Z", "iopub.status.busy": "2026-05-20T17:59:16.819635Z", "iopub.status.idle": "2026-05-20T17:59:16.941086Z", "shell.execute_reply": "2026-05-20T17:59:16.940406Z", "shell.execute_reply.started": "2026-05-20T17:59:16.819799Z" } }, "outputs": [], "source": [ "!export PATH=/usr/local/opt/python@3.13/bin:$PATH" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.13 Kernel", "language": "python", "name": "python313" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.0" }, "latex_envs": { "LaTeX_envs_menu_present": true, "autoclose": false, "autocomplete": true, "bibliofile": "biblio.bib", "cite_by": "apalike", "current_citInitial": 1, "eqLabelWithNumbers": true, "eqNumInitial": 1, "hotkeys": { "equation": "Ctrl-E", "itemize": "Ctrl-I" }, "labels_anchors": false, "latex_user_defs": false, "report_style_numbering": false, "user_envs_cfg": false }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }