{ "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": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "…\n", "HOME=/Users/veit\n", "…\n", "PATH=/Users/veit/Library/Caches/uv/archive-v0/8SR6iAPFDtNw2pfP04l3g/bin:/Users/veit/cusy/trn/Python4DataScience/.venv/bin:/Users/veit/sandbox/py313/.venv/bin:/opt/homebrew/opt/ruby/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\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": {}, "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": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/Users/veit/Library/Caches/uv/archive-v0/8SR6iAPFDtNw2pfP04l3g/bin:/Users/veit/cusy/trn/Python4DataScience/.venv/bin:/Users/veit/sandbox/py313/.venv/bin:/opt/homebrew/opt/ruby/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\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": {}, "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": {}, "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 }