bash-hackers-wiki/syntax/shellvars/index.html

37 lines
140 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html><html lang=en class=no-js> <head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link href=https://flokoe.github.io/bash-hackers-wiki/syntax/shellvars/ rel=canonical><link href=../redirection/ rel=prev><link href=../words/ rel=next><link rel=icon href=../../assets/images/favicon.png><meta name=generator content="mkdocs-1.6.1, mkdocs-material-9.5.44"><title>Special parameters and shell variables - The Bash Hackers Wiki</title><link rel=stylesheet href=../../assets/stylesheets/main.0253249f.min.css><link rel=stylesheet href=../../assets/stylesheets/palette.06af60db.min.css><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback"><style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style><script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script></head> <body dir=ltr data-md-color-scheme=default data-md-color-primary=indigo data-md-color-accent=indigo> <input class=md-toggle data-md-toggle=drawer type=checkbox id=__drawer autocomplete=off> <input class=md-toggle data-md-toggle=search type=checkbox id=__search autocomplete=off> <label class=md-overlay for=__drawer></label> <div data-md-component=skip> <a href=#special-parameters-and-shell-variables class=md-skip> Skip to content </a> </div> <div data-md-component=announce> </div> <header class=md-header data-md-component=header> <nav class="md-header__inner md-grid" aria-label=Header> <a href=../.. title="The Bash Hackers Wiki" class="md-header__button md-logo" aria-label="The Bash Hackers Wiki" data-md-component=logo> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg> </a> <label class="md-header__button md-icon" for=__drawer> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg> </label> <div class=md-header__title data-md-component=header-title> <div class=md-header__ellipsis> <div class=md-header__topic> <span class=md-ellipsis> The Bash Hackers Wiki </span> </div> <div class=md-header__topic data-md-component=header-topic> <span class=md-ellipsis> Special parameters and shell variables </span> </div> </div> </div> <form class=md-header__option data-md-component=palette> <input class=md-option data-md-color-media data-md-color-scheme=default data-md-color-primary=indigo data-md-color-accent=indigo aria-label="Switch to dark mode" type=radio name=__palette id=__palette_0> <label class="md-header__button md-icon" title="Switch to dark mode" for=__palette_1 hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg> </label> <input class=md-option data-md-color-media data-md-color-scheme=slate data-md-color-primary=indigo data-md-color-accent=indigo aria-label="Switch to light mode" type=radio name=__palette id=__palette_1> <label class="md-header__button md-icon" title="Switch to light mode" for=__palette_0 hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg> </label> </form> <script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script> <label class="md-header__button md-icon" for=__search> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg> </label> <div class=md-search data-md-component=search role=dialog> <label class=md-search__overlay for=__search></label> <div class=md-search__inner role=search> <form class=md-search__form name=search> <input type=text class=md-search__input name=query aria-label=Search placeholder=Search autocapitalize=off autocorrect=off autocomplete=off spellcheck=false data-md-component=search-query required> <label class="md-search__icon md-icon" for=__search> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg> </label> <nav class=md-search__options aria-label=Search> <button type=reset class="md-search__icon md-icon" title=Clear aria-label=Clear tabindex=-1> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg> </button> </nav> <div class=md-search__suggest data-md-component=search-suggest></div> </form> <div class=md-search__output> <div class=md-search__scrollwrap tabindex=0 data-md-scrollfix> <div class=md-search-result data-md-component=search-result> <div class=md-search-result__meta> Initializing search </div> <ol class=md-search-result__list role=presentation></ol> </div> </div> </div> </div> </div> <div class=md-header__source> <a href=https://github.com/flokoe/bash-hackers-wiki title="Go to repository" class=md-source data-md-component=source> <div class="md-source__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 496 512"><!-- Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9s4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2"/></svg> </div> <div class=md-source__repository> flokoe/bash-hackers-wiki </div> </a> </div> </nav> </header> <div class=md-container data-md-component=container> <nav class=md-tabs aria-label=Tabs data-md-component=tabs> <div class=md-grid> <ul class=md-tabs__list> <li class=md-tabs__item> <a href=../.. class=md-tabs__link> Start </a> </li> <li class=md-tabs__item> <a href=../../commands/classictest/ class=md-tabs__link> Commands </a> </li> <li class=md-tabs__item> <a href=../../dict/directory/ class=md-tabs__link> Dict </a> </li> <li class=md-tabs__item> <a href=../../howto/calculate-dc/ class=md-tabs__link> Howto </a> </li> <li class=md-tabs__item> <a href=../../internals/shell_options/ class=md-tabs__link> Internals </a> </li> <li class=md-tabs__item> <a href=../../misc/bashphorisms/ class=md-tabs__link> Misc </a> </li> <li class=md-tabs__item> <a href=../../scripting/bashbehaviour/ class=md-tabs__link> Scripting </a> </li> <li class=md-tabs__item> <a href=../../snipplets/ class=md-tabs__link> Snipplets </a> </li> <li class="md-tabs__item md-tabs__item--active"> <a href=../arith_expr/ class=md-tabs__link> Syntax </a> </li> <li class=md-tabs__item> <a href=../../tags/ class=md-tabs__link> Tags </a> </li> </ul> </div> </nav> <main class=md-main data-md-component=main> <div class="md-main__inner md-grid"> <div class="md-sidebar md-sidebar--primary" data-md-component=sidebar data-md-type=navigation> <div class=md-sidebar__scrollwrap> <div class=md-sidebar__inner> <nav class="md-nav md-nav--primary md-nav--lifted" aria-label=Navigation data-md-level=0> <label class=md-nav__title for=__drawer> <a href=../.. title="The Bash Hackers Wiki" class="md-nav__button md-logo" aria-label="The Bash Hackers Wiki" data-md-component=logo> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg> </a> The Bash Hackers Wiki </label> <div class=md-nav__source> <a href=https://github.com/flokoe/bash-hackers-wiki title="Go to repository" class=md-source data-md-component=source> <div class="md-source__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 496 512"><!-- Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9s4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2"/></svg> </div> <div class=md-source__repository> flokoe/bash-hackers-wiki </div> </a> </div> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../.. class=md-nav__link> <span class=md-ellipsis> Start </span> </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_2> <label class=md-nav__link for=__nav_2 id=__nav_2_label tabindex=0> <span class=md-ellipsis> Commands </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=1 aria-labelledby=__nav_2_label aria-expanded=false> <label class=md-nav__title for=__nav_2> <span class="md-nav__icon md-icon"></span> Commands </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../../commands/classictest/ class=md-nav__link> <span class=md-ellipsis> The classic test command </span> </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_2_2> <label class=md-nav__link for=__nav_2_2 id=__nav_2_2_label tabindex=0> <span class=md-ellipsis> Builtin </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=2 aria-labelledby=__nav_2_2_label aria-expanded=false> <label class=md-nav__title for=__nav_2_2> <span class="md-nav__icon md-icon"></span> Builtin </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../../commands/builtin/caller/ class=md-nav__link> <span class=md-ellipsis> The caller builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/cd/ class=md-nav__link> <span class=md-ellipsis> The cd builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/declare/ class=md-nav__link> <span class=md-ellipsis> The declare builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/echo/ class=md-nav__link> <span class=md-ellipsis> The echo builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/eval/ class=md-nav__link> <span class=md-ellipsis> The eval builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/exec/ class=md-nav__link> <span class=md-ellipsis> The exec builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/exit/ class=md-nav__link> <span class=md-ellipsis> The exit builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/export/ class=md-nav__link> <span class=md-ellipsis> The export builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/kill/ class=md-nav__link> <span class=md-ellipsis> The kill builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/let/ class=md-nav__link> <span class=md-ellipsis> The let builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/local/ class=md-nav__link> <span class=md-ellipsis> The local builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/mapfile/ class=md-nav__link> <span class=md-ellipsis> The mapfile builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/printf/ class=md-nav__link> <span class=md-ellipsis> The printf command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/read/ class=md-nav__link> <span class=md-ellipsis> The read builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/readonly/ class=md-nav__link> <span class=md-ellipsis> The readonly builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/return/ class=md-nav__link> <span class=md-ellipsis> The return builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/set/ class=md-nav__link> <span class=md-ellipsis> The set builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/shift/ class=md-nav__link> <span class=md-ellipsis> The shift builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/shopt/ class=md-nav__link> <span class=md-ellipsis> The shopt builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/trap/ class=md-nav__link> <span class=md-ellipsis> The trap builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/unset/ class=md-nav__link> <span class=md-ellipsis> The unset builtin command </span> </a> </li> <li class=md-nav__item> <a href=../../commands/builtin/wait/ class=md-nav__link> <span class=md-ellipsis> The wait builtin command </span> </a> </li> </ul> </nav> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_3> <label class=md-nav__link for=__nav_3 id=__nav_3_label tabindex=0> <span class=md-ellipsis> Dict </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=1 aria-labelledby=__nav_3_label aria-expanded=false> <label class=md-nav__title for=__nav_3> <span class="md-nav__icon md-icon"></span> Dict </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../../dict/directory/ class=md-nav__link> <span class=md-ellipsis> Directory </span> </a> </li> <li class=md-nav__item> <a href=../../dict/end_of_options/ class=md-nav__link> <span class=md-ellipsis> End of Options </span> </a> </li> <li class=md-nav__item> <a href=../../dict/exit_status/ class=md-nav__link> <span class=md-ellipsis> Exit Status </span> </a> </li> <li class=md-nav__item> <a href=../../dict/file/ class=md-nav__link> <span class=md-ellipsis> File </span> </a> </li> <li class=md-nav__item> <a href=../../dict/filetimes/ class=md-nav__link> <span class=md-ellipsis> File timestamp </span> </a> </li> <li class=md-nav__item> <a href=../../dict/globbing/ class=md-nav__link> <span class=md-ellipsis> Globbing </span> </a> </li> <li class=md-nav__item> <a href=../../dict/hardlink/ class=md-nav__link> <span class=md-ellipsis> Hardlink </span> </a> </li> <li class=md-nav__item> <a href=../../dict/interpreter_directive/ class=md-nav__link> <span class=md-ellipsis> Interpreter Directive </span> </a> </li> <li class=md-nav__item> <a href=../../dict/parameter/ class=md-nav__link> <span class=md-ellipsis> Parameter </span> </a> </li> <li class=md-nav__item> <a href=../../dict/posix/ class=md-nav__link> <span class=md-ellipsis> POSIX </span> </a> </li> <li class=md-nav__item> <a href=../../dict/shell/ class=md-nav__link> <span class=md-ellipsis> Shell </span> </a> </li> <li class=md-nav__item> <a href=../../dict/special_file/ class=md-nav__link> <span class=md-ellipsis> Special file </span> </a> </li> <li class=md-nav__item> <a href=../../dict/symlink/ class=md-nav__link> <span class=md-ellipsis> Symlink </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_4> <label class=md-nav__link for=__nav_4 id=__nav_4_label tabindex=0> <span class=md-ellipsis> Howto </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=1 aria-labelledby=__nav_4_label aria-expanded=false> <label class=md-nav__title for=__nav_4> <span class="md-nav__icon md-icon"></span> Howto </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../../howto/calculate-dc/ class=md-nav__link> <span class=md-ellipsis> Calculating with dc </span> </a> </li> <li class=md-nav__item> <a href=../../howto/collapsing_functions/ class=md-nav__link> <span class=md-ellipsis> Collapsing Functions </span> </a> </li> <li class=md-nav__item> <a href=../../howto/conffile/ class=md-nav__link> <span class=md-ellipsis> Config files for your script </span> </a> </li> <li class=md-nav__item> <a href=../../howto/dissectabadoneliner/ class=md-nav__link> <span class=md-ellipsis> Dissect a bad oneliner </span> </a> </li> <li class=md-nav__item> <a href=../../howto/edit-ed/ class=md-nav__link> <span class=md-ellipsis> Editing files via scripts with ed </span> </a> </li> <li class=md-nav__item> <a href=../../howto/getopts_tutorial/ class=md-nav__link> <span class=md-ellipsis> Small getopts tutorial </span> </a> </li> <li class=md-nav__item> <a href=../../howto/mutex/ class=md-nav__link> <span class=md-ellipsis> Lock your script (against parallel execution) </span> </a> </li> <li class=md-nav__item> <a href=../../howto/pax/ class=md-nav__link> <span class=md-ellipsis> pax - the POSIX archiver </span> </a> </li> <li class=md-nav__item> <a href=../../howto/redirection_tutorial/ class=md-nav__link> <span class=md-ellipsis> Illustrated Redirection Tutorial </span> </a> </li> <li class=md-nav__item> <a href=../../howto/testing-your-scripts/ class=md-nav__link> <span class=md-ellipsis> Testing your scripts </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_5> <label class=md-nav__link for=__nav_5 id=__nav_5_label tabindex=0> <span class=md-ellipsis> Internals </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=1 aria-labelledby=__nav_5_label aria-expanded=false> <label class=md-nav__title for=__nav_5> <span class="md-nav__icon md-icon"></span> Internals </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../../internals/shell_options/ class=md-nav__link> <span class=md-ellipsis> List of shell options </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_6> <label class=md-nav__link for=__nav_6 id=__nav_6_label tabindex=0> <span class=md-ellipsis> Misc </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=1 aria-labelledby=__nav_6_label aria-expanded=false> <label class=md-nav__title for=__nav_6> <span class="md-nav__icon md-icon"></span> Misc </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../../misc/bashphorisms/ class=md-nav__link> <span class=md-ellipsis> The Bashphorisms </span> </a> </li> <li class=md-nav__item> <a href=../../misc/readthesourceluke/ class=md-nav__link> <span class=md-ellipsis> Readthesourceluke </span> </a> </li> <li class=md-nav__item> <a href=../../misc/shell_humor/ class=md-nav__link> <span class=md-ellipsis> Shell Humor </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_7> <label class=md-nav__link for=__nav_7 id=__nav_7_label tabindex=0> <span class=md-ellipsis> Scripting </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=1 aria-labelledby=__nav_7_label aria-expanded=false> <label class=md-nav__title for=__nav_7> <span class="md-nav__icon md-icon"></span> Scripting </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../../scripting/bashbehaviour/ class=md-nav__link> <span class=md-ellipsis> Bash's behaviour </span> </a> </li> <li class=md-nav__item> <a href=../../scripting/bashchanges/ class=md-nav__link> <span class=md-ellipsis> Bash changes </span> </a> </li> <li class=md-nav__item> <a href=../../scripting/basics/ class=md-nav__link> <span class=md-ellipsis> The basics of shell scripting </span> </a> </li> <li class=md-nav__item> <a href=../../scripting/debuggingtips/ class=md-nav__link> <span class=md-ellipsis> Debugging a script </span> </a> </li> <li class=md-nav__item> <a href=../../scripting/newbie_traps/ class=md-nav__link> <span class=md-ellipsis> Beginner Mistakes </span> </a> </li> <li class=md-nav__item> <a href=../../scripting/nonportable/ class=md-nav__link> <span class=md-ellipsis> Portability talk </span> </a> </li> <li class=md-nav__item> <a href=../../scripting/obsolete/ class=md-nav__link> <span class=md-ellipsis> Obsolete and deprecated syntax </span> </a> </li> <li class=md-nav__item> <a href=../../scripting/posparams/ class=md-nav__link> <span class=md-ellipsis> Handling positional parameters </span> </a> </li> <li class=md-nav__item> <a href=../../scripting/processtree/ class=md-nav__link> <span class=md-ellipsis> Bash and the process tree </span> </a> </li> <li class=md-nav__item> <a href=../../scripting/style/ class=md-nav__link> <span class=md-ellipsis> Scripting with style </span> </a> </li> <li class=md-nav__item> <a href=../../scripting/terminalcodes/ class=md-nav__link> <span class=md-ellipsis> Terminal codes (ANSI/VT100) introduction </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_8> <label class=md-nav__link for=__nav_8 id=__nav_8_label tabindex=0> <span class=md-ellipsis> Snipplets </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=1 aria-labelledby=__nav_8_label aria-expanded=false> <label class=md-nav__title for=__nav_8> <span class="md-nav__icon md-icon"></span> Snipplets </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../../snipplets/ class=md-nav__link> <span class=md-ellipsis> Small code snipplets </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/add_color_to_your_scripts/ class=md-nav__link> <span class=md-ellipsis> Add Color to your scripts </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/awkcsv/ class=md-nav__link> <span class=md-ellipsis> Using awk to deal with CSV that uses quoted/unquoted delimiters </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/filesize/ class=md-nav__link> <span class=md-ellipsis> Show size of a file </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/kill_bg_job_without_message/ class=md-nav__link> <span class=md-ellipsis> Kill a background job without a message </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/largestfile/ class=md-nav__link> <span class=md-ellipsis> Get largest file </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/pause_command/ class=md-nav__link> <span class=md-ellipsis> Pausing a script (like MSDOS pause command) </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/prargs/ class=md-nav__link> <span class=md-ellipsis> Print argument list for testing </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/print_horizontal_line/ class=md-nav__link> <span class=md-ellipsis> Print a horizontal line </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/rndstr/ class=md-nav__link> <span class=md-ellipsis> Print a random string or select random elements </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/screen_saverestore/ class=md-nav__link> <span class=md-ellipsis> Save and restore terminal/screen content </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/ssh_fetchkeys/ class=md-nav__link> <span class=md-ellipsis> Fetching SSH hostkeys without interaction </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/ssh_local_var/ class=md-nav__link> <span class=md-ellipsis> Run some bash commands with SSH remotely using local variables </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/wrapperargs/ class=md-nav__link> <span class=md-ellipsis> Generate code with own arguments properly quoted </span> </a> </li> <li class=md-nav__item> <a href=../../snipplets/xclip/ class=md-nav__link> <span class=md-ellipsis> X-Clipboard on Commandline </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_9 checked> <label class=md-nav__link for=__nav_9 id=__nav_9_label tabindex> <span class=md-ellipsis> Syntax </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=1 aria-labelledby=__nav_9_label aria-expanded=true> <label class=md-nav__title for=__nav_9> <span class="md-nav__icon md-icon"></span> Syntax </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../arith_expr/ class=md-nav__link> <span class=md-ellipsis> Arithmetic expressions </span> </a> </li> <li class=md-nav__item> <a href=../arrays/ class=md-nav__link> <span class=md-ellipsis> Arrays </span> </a> </li> <li class=md-nav__item> <a href=../basicgrammar/ class=md-nav__link> <span class=md-ellipsis> Basic grammar rules of Bash </span> </a> </li> <li class=md-nav__item> <a href=../pattern/ class=md-nav__link> <span class=md-ellipsis> Patterns and pattern matching </span> </a> </li> <li class=md-nav__item> <a href=../pe/ class=md-nav__link> <span class=md-ellipsis> Parameter expansion </span> </a> </li> <li class=md-nav__item> <a href=../quoting/ class=md-nav__link> <span class=md-ellipsis> Quotes and escaping </span> </a> </li> <li class=md-nav__item> <a href=../redirection/ class=md-nav__link> <span class=md-ellipsis> Redirection </span> </a> </li> <li class="md-nav__item md-nav__item--active"> <input class="md-nav__toggle md-toggle" type=checkbox id=__toc> <label class="md-nav__link md-nav__link--active" for=__toc> <span class=md-ellipsis> Special parameters and shell variables </span> <span class="md-nav__icon md-icon"></span> </label> <a href=./ class="md-nav__link md-nav__link--active"> <span class=md-ellipsis> Special parameters and shell variables </span> </a> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <label class=md-nav__title for=__toc> <span class="md-nav__icon md-icon"></span> Table of contents </label> <ul class=md-nav__list data-md-component=toc data-md-scrollfix> <li class=md-nav__item> <a href=#special-parameters class=md-nav__link> <span class=md-ellipsis> Special Parameters </span> </a> </li> <li class=md-nav__item> <a href=#shell-variables class=md-nav__link> <span class=md-ellipsis> Shell Variables </span> </a> <nav class=md-nav aria-label="Shell Variables"> <ul class=md-nav__list> <li class=md-nav__item> <a href=#bash class=md-nav__link> <span class=md-ellipsis> BASH </span> </a> </li> <li class=md-nav__item> <a href=#bashopts class=md-nav__link> <span class=md-ellipsis> BASHOPTS </span> </a> </li> <li class=md-nav__item> <a href=#bashpid class=md-nav__link> <span class=md-ellipsis> BASHPID </span> </a> </li> <li class=md-nav__item> <a href=#bash_aliases class=md-nav__link> <span class=md-ellipsis> BASH_ALIASES </span> </a> </li> <li class=md-nav__item> <a href=#bash_argc class=md-nav__link> <span class=md-ellipsis> BASH_ARGC </span> </a> </li> <li class=md-nav__item> <a href=#bash_argv class=md-nav__link> <span class=md-ellipsis> BASH_ARGV </span> </a> </li> <li class=md-nav__item> <a href=#bash_argv0 class=md-nav__link> <span class=md-ellipsis> BASH_ARGV0 </span> </a> </li> <li class=md-nav__item> <a href=#bash_cmds class=md-nav__link> <span class=md-ellipsis> BASH_CMDS </span> </a> </li> <li class=md-nav__item> <a href=#bash_command class=md-nav__link> <span class=md-ellipsis> BASH_COMMAND </span> </a> </li> <li class=md-nav__item> <a href=#bash_compat class=md-nav__link> <span class=md-ellipsis> BASH_COMPAT </span> </a> </li> <li class=md-nav__item> <a href=#bash_execution_string class=md-nav__link> <span class=md-ellipsis> BASH_EXECUTION_STRING </span> </a> </li> <li class=md-nav__item> <a href=#bash_lineno class=md-nav__link> <span class=md-ellipsis> BASH_LINENO </span> </a> </li> <li class=md-nav__item> <a href=#bash_rematch class=md-nav__link> <span class=md-ellipsis> BASH_REMATCH </span> </a> </li> <li class=md-nav__item> <a href=#bash_source class=md-nav__link> <span class=md-ellipsis> BASH_SOURCE </span> </a> </li> <li class=md-nav__item> <a href=#bash_subshell class=md-nav__link> <span class=md-ellipsis> BASH_SUBSHELL </span> </a> </li> <li class=md-nav__item> <a href=#bash_versinfo class=md-nav__link> <span class=md-ellipsis> BASH_VERSINFO </span> </a> </li> <li class=md-nav__item> <a href=#bash_version class=md-nav__link> <span class=md-ellipsis> BASH_VERSION </span> </a> </li> <li class=md-nav__item> <a href=#child_max class=md-nav__link> <span class=md-ellipsis> CHILD_MAX </span> </a> </li> <li class=md-nav__item> <a href=#comp_cword class=md-nav__link> <span class=md-ellipsis> COMP_CWORD </span> </a> </li> <li class=md-nav__item> <a href=#comp_key class=md-nav__link> <span class=md-ellipsis> COMP_KEY </span> </a> </li> <li class=md-nav__item> <a href=#comp_line class=md-nav__link> <span class=md-ellipsis> COMP_LINE </span> </a> </li> <li class=md-nav__item> <a href=#comp_point class=md-nav__link> <span class=md-ellipsis> COMP_POINT </span> </a> </li> <li class=md-nav__item> <a href=#comp_type class=md-nav__link> <span class=md-ellipsis> COMP_TYPE </span> </a> </li> <li class=md-nav__item> <a href=#comp_wordbreaks class=md-nav__link> <span class=md-ellipsis> COMP_WORDBREAKS </span> </a> </li> <li class=md-nav__item> <a href=#comp_words class=md-nav__link> <span class=md-ellipsis> COMP_WORDS </span> </a> </li> <li class=md-nav__item> <a href=#coproc class=md-nav__link> <span class=md-ellipsis> COPROC </span> </a> </li> <li class=md-nav__item> <a href=#dirstack class=md-nav__link> <span class=md-ellipsis> DIRSTACK </span> </a> </li> <li class=md-nav__item> <a href=#epochrealtime class=md-nav__link> <span class=md-ellipsis> EPOCHREALTIME </span> </a> </li> <li class=md-nav__item> <a href=#epochseconds class=md-nav__link> <span class=md-ellipsis> EPOCHSECONDS </span> </a> </li> <li class=md-nav__item> <a href=#euid class=md-nav__link> <span class=md-ellipsis> EUID </span> </a> </li> <li class=md-nav__item> <a href=#funcname class=md-nav__link> <span class=md-ellipsis> FUNCNAME </span> </a> </li> <li class=md-nav__item> <a href=#groups class=md-nav__link> <span class=md-ellipsis> GROUPS </span> </a> </li> <li class=md-nav__item> <a href=#histcmd class=md-nav__link> <span class=md-ellipsis> HISTCMD </span> </a> </li> <li class=md-nav__item> <a href=#hostname class=md-nav__link> <span class=md-ellipsis> HOSTNAME </span> </a> </li> <li class=md-nav__item> <a href=#hosttype class=md-nav__link> <span class=md-ellipsis> HOSTTYPE </span> </a> </li> <li class=md-nav__item> <a href=#lineno class=md-nav__link> <span class=md-ellipsis> LINENO </span> </a> </li> <li class=md-nav__item> <a href=#machtype class=md-nav__link> <span class=md-ellipsis> MACHTYPE </span> </a> </li> <li class=md-nav__item> <a href=#mapfile class=md-nav__link> <span class=md-ellipsis> MAPFILE </span> </a> </li> <li class=md-nav__item> <a href=#oldpwd class=md-nav__link> <span class=md-ellipsis> OLDPWD </span> </a> </li> <li class=md-nav__item> <a href=#optarg class=md-nav__link> <span class=md-ellipsis> OPTARG </span> </a> </li> <li class=md-nav__item> <a href=#optind class=md-nav__link> <span class=md-ellipsis> OPTIND </span> </a> </li> <li class=md-nav__item> <a href=#ostype class=md-nav__link> <span class=md-ellipsis> OSTYPE </span> </a> </li> <li class=md-nav__item> <a href=#pipestatus class=md-nav__link> <span class=md-ellipsis> PIPESTATUS </span> </a> </li> <li class=md-nav__item> <a href=#ppid class=md-nav__link> <span class=md-ellipsis> PPID </span> </a> </li> <li class=md-nav__item> <a href=#pwd class=md-nav__link> <span class=md-ellipsis> PWD </span> </a> </li> <li class=md-nav__item> <a href=#random class=md-nav__link> <span class=md-ellipsis> RANDOM </span> </a> </li> <li class=md-nav__item> <a href=#readline_line class=md-nav__link> <span class=md-ellipsis> READLINE_LINE </span> </a> </li> <li class=md-nav__item> <a href=#readline_point class=md-nav__link> <span class=md-ellipsis> READLINE_POINT </span> </a> </li> <li class=md-nav__item> <a href=#reply class=md-nav__link> <span class=md-ellipsis> REPLY </span> </a> </li> <li class=md-nav__item> <a href=#seconds class=md-nav__link> <span class=md-ellipsis> SECONDS </span> </a> </li> <li class=md-nav__item> <a href=#shellopts class=md-nav__link> <span class=md-ellipsis> SHELLOPTS </span> </a> </li> <li class=md-nav__item> <a href=#shlvl class=md-nav__link> <span class=md-ellipsis> SHLVL </span> </a> </li> <li class=md-nav__item> <a href=#uid class=md-nav__link> <span class=md-ellipsis> UID </span> </a> </li> <li class=md-nav__item> <a href=#bash_env class=md-nav__link> <span class=md-ellipsis> BASH_ENV </span> </a> </li> <li class=md-nav__item> <a href=#bash_xtracefd class=md-nav__link> <span class=md-ellipsis> BASH_XTRACEFD </span> </a> </li> <li class=md-nav__item> <a href=#cdpath class=md-nav__link> <span class=md-ellipsis> CDPATH </span> </a> </li> <li class=md-nav__item> <a href=#columns class=md-nav__link> <span class=md-ellipsis> COLUMNS </span> </a> </li> <li class=md-nav__item> <a href=#compreply class=md-nav__link> <span class=md-ellipsis> COMPREPLY </span> </a> </li> <li class=md-nav__item> <a href=#emacs class=md-nav__link> <span class=md-ellipsis> EMACS </span> </a> </li> <li class=md-nav__item> <a href=#env class=md-nav__link> <span class=md-ellipsis> ENV </span> </a> </li> <li class=md-nav__item> <a href=#fcedit class=md-nav__link> <span class=md-ellipsis> FCEDIT </span> </a> </li> <li class=md-nav__item> <a href=#fignore class=md-nav__link> <span class=md-ellipsis> FIGNORE </span> </a> </li> <li class=md-nav__item> <a href=#funcnest class=md-nav__link> <span class=md-ellipsis> FUNCNEST </span> </a> </li> <li class=md-nav__item> <a href=#globignore class=md-nav__link> <span class=md-ellipsis> GLOBIGNORE </span> </a> </li> <li class=md-nav__item> <a href=#histcontrol class=md-nav__link> <span class=md-ellipsis> HISTCONTROL </span> </a> </li> <li class=md-nav__item> <a href=#histfile class=md-nav__link> <span class=md-ellipsis> HISTFILE </span> </a> </li> <li class=md-nav__item> <a href=#histfilesize class=md-nav__link> <span class=md-ellipsis> HISTFILESIZE </span> </a> </li> <li class=md-nav__item> <a href=#histignore class=md-nav__link> <span class=md-ellipsis> HISTIGNORE </span> </a> </li> <li class=md-nav__item> <a href=#histsize class=md-nav__link> <span class=md-ellipsis> HISTSIZE </span> </a> </li> <li class=md-nav__item> <a href=#histtimeformat class=md-nav__link> <span class=md-ellipsis> HISTTIMEFORMAT </span> </a> </li> <li class=md-nav__item> <a href=#home class=md-nav__link> <span class=md-ellipsis> HOME </span> </a> </li> <li class=md-nav__item> <a href=#hostfile class=md-nav__link> <span class=md-ellipsis> HOSTFILE </span> </a> </li> <li class=md-nav__item> <a href=#ifs class=md-nav__link> <span class=md-ellipsis> IFS </span> </a> </li> <li class=md-nav__item> <a href=#ignoreeof class=md-nav__link> <span class=md-ellipsis> IGNOREEOF </span> </a> </li> <li class=md-nav__item> <a href=#inputrc class=md-nav__link> <span class=md-ellipsis> INPUTRC </span> </a> </li> <li class=md-nav__item> <a href=#lang class=md-nav__link> <span class=md-ellipsis> LANG </span> </a> </li> <li class=md-nav__item> <a href=#lc_all class=md-nav__link> <span class=md-ellipsis> LC_ALL </span> </a> </li> <li class=md-nav__item> <a href=#lc_collate class=md-nav__link> <span class=md-ellipsis> LC_COLLATE </span> </a> </li> <li class=md-nav__item> <a href=#lc_ctype class=md-nav__link> <span class=md-ellipsis> LC_CTYPE </span> </a> </li> <li class=md-nav__item> <a href=#lc_messages class=md-nav__link> <span class=md-ellipsis> LC_MESSAGES </span> </a> </li> <li class=md-nav__item> <a href=#lc_numeric class=md-nav__link> <span class=md-ellipsis> LC_NUMERIC </span> </a> </li> <li class=md-nav__item> <a href=#lines class=md-nav__link> <span class=md-ellipsis> LINES </span> </a> </li> <li class=md-nav__item> <a href=#mail class=md-nav__link> <span class=md-ellipsis> MAIL </span> </a> </li> <li class=md-nav__item> <a href=#mailcheck class=md-nav__link> <span class=md-ellipsis> MAILCHECK </span> </a> </li> <li class=md-nav__item> <a href=#mailpath class=md-nav__link> <span class=md-ellipsis> MAILPATH </span> </a> </li> <li class=md-nav__item> <a href=#opterr class=md-nav__link> <span class=md-ellipsis> OPTERR </span> </a> </li> <li class=md-nav__item> <a href=#path class=md-nav__link> <span class=md-ellipsis> PATH </span> </a> </li> <li class=md-nav__item> <a href=#posixly_correct class=md-nav__link> <span class=md-ellipsis> POSIXLY_CORRECT </span> </a> </li> <li class=md-nav__item> <a href=#prompt_command class=md-nav__link> <span class=md-ellipsis> PROMPT_COMMAND </span> </a> </li> <li class=md-nav__item> <a href=#prompt_commands class=md-nav__link> <span class=md-ellipsis> PROMPT_COMMANDS </span> </a> </li> <li class=md-nav__item> <a href=#prompt_dirtrim class=md-nav__link> <span class=md-ellipsis> PROMPT_DIRTRIM </span> </a> </li> <li class=md-nav__item> <a href=#ps0 class=md-nav__link> <span class=md-ellipsis> PS0 </span> </a> </li> <li class=md-nav__item> <a href=#ps1 class=md-nav__link> <span class=md-ellipsis> PS1 </span> </a> </li> <li class=md-nav__item> <a href=#ps2 class=md-nav__link> <span class=md-ellipsis> PS2 </span> </a> </li> <li class=md-nav__item> <a href=#ps3 class=md-nav__link> <span class=md-ellipsis> PS3 </span> </a> </li> <li class=md-nav__item> <a href=#ps4 class=md-nav__link> <span class=md-ellipsis> PS4 </span> </a> </li> <li class=md-nav__item> <a href=#shell class=md-nav__link> <span class=md-ellipsis> SHELL </span> </a> </li> <li class=md-nav__item> <a href=#srandom class=md-nav__link> <span class=md-ellipsis> SRANDOM </span> </a> </li> <li class=md-nav__item> <a href=#timeformat class=md-nav__link> <span class=md-ellipsis> TIMEFORMAT </span> </a> </li> <li class=md-nav__item> <a href=#tmout class=md-nav__link> <span class=md-ellipsis> TMOUT </span> </a> </li> <li class=md-nav__item> <a href=#tmpdir class=md-nav__link> <span class=md-ellipsis> TMPDIR </span> </a> </li> <li class=md-nav__item> <a href=#auto_resume class=md-nav__link> <span class=md-ellipsis> auto_resume </span> </a> </li> <li class=md-nav__item> <a href=#histchars class=md-nav__link> <span class=md-ellipsis> histchars </span> </a> </li> </ul> </nav> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../words/ class=md-nav__link> <span class=md-ellipsis> Words... </span> </a> </li> <li class="md-nav__item md-nav__item--section md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_9_10> <label class=md-nav__link for=__nav_9_10 id=__nav_9_10_label tabindex> <span class=md-ellipsis> Ccmd </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=2 aria-labelledby=__nav_9_10_label aria-expanded=false> <label class=md-nav__title for=__nav_9_10> <span class="md-nav__icon md-icon"></span> Ccmd </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../ccmd/arithmetic_eval/ class=md-nav__link> <span class=md-ellipsis> Arithmetic evaluation (command) </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/c_for/ class=md-nav__link> <span class=md-ellipsis> The C-style for-loop </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/case/ class=md-nav__link> <span class=md-ellipsis> The case statement </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/classic_for/ class=md-nav__link> <span class=md-ellipsis> The classic for-loop </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/conditional_expression/ class=md-nav__link> <span class=md-ellipsis> The conditional expression </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/grouping_plain/ class=md-nav__link> <span class=md-ellipsis> Grouping commands </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/grouping_subshell/ class=md-nav__link> <span class=md-ellipsis> Grouping commands in a subshell </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/if_clause/ class=md-nav__link> <span class=md-ellipsis> The if-clause </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/intro/ class=md-nav__link> <span class=md-ellipsis> Bash compound commands </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/until_loop/ class=md-nav__link> <span class=md-ellipsis> The until loop </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/user_select/ class=md-nav__link> <span class=md-ellipsis> User selections </span> </a> </li> <li class=md-nav__item> <a href=../ccmd/while_loop/ class=md-nav__link> <span class=md-ellipsis> The while-loop </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--section md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_9_11> <label class=md-nav__link for=__nav_9_11 id=__nav_9_11_label tabindex> <span class=md-ellipsis> Expansion </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=2 aria-labelledby=__nav_9_11_label aria-expanded=false> <label class=md-nav__title for=__nav_9_11> <span class="md-nav__icon md-icon"></span> Expansion </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../expansion/arith/ class=md-nav__link> <span class=md-ellipsis> Arithmetic expansion </span> </a> </li> <li class=md-nav__item> <a href=../expansion/brace/ class=md-nav__link> <span class=md-ellipsis> Brace expansion </span> </a> </li> <li class=md-nav__item> <a href=../expansion/cmdsubst/ class=md-nav__link> <span class=md-ellipsis> Command substitution </span> </a> </li> <li class=md-nav__item> <a href=../expansion/globs/ class=md-nav__link> <span class=md-ellipsis> Pathname expansion (globbing) </span> </a> </li> <li class=md-nav__item> <a href=../expansion/intro/ class=md-nav__link> <span class=md-ellipsis> Expansions and substitutions </span> </a> </li> <li class=md-nav__item> <a href=../expansion/proc_subst/ class=md-nav__link> <span class=md-ellipsis> Process substitution </span> </a> </li> <li class=md-nav__item> <a href=../expansion/tilde/ class=md-nav__link> <span class=md-ellipsis> Tilde expansion </span> </a> </li> <li class=md-nav__item> <a href=../expansion/wordsplit/ class=md-nav__link> <span class=md-ellipsis> Word splitting </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--section md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_9_12> <label class=md-nav__link for=__nav_9_12 id=__nav_9_12_label tabindex> <span class=md-ellipsis> Grammar </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=2 aria-labelledby=__nav_9_12_label aria-expanded=false> <label class=md-nav__title for=__nav_9_12> <span class="md-nav__icon md-icon"></span> Grammar </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../grammar/parser_exec/ class=md-nav__link> <span class=md-ellipsis> Parser exec </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--section md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_9_13> <label class=md-nav__link for=__nav_9_13 id=__nav_9_13_label tabindex> <span class=md-ellipsis> Keywords </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=2 aria-labelledby=__nav_9_13_label aria-expanded=false> <label class=md-nav__title for=__nav_9_13> <span class="md-nav__icon md-icon"></span> Keywords </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../keywords/coproc/ class=md-nav__link> <span class=md-ellipsis> The coproc keyword </span> </a> </li> </ul> </nav> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../../tags/ class=md-nav__link> <span class=md-ellipsis> Tags </span> </a> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component=sidebar data-md-type=toc> <div class=md-sidebar__scrollwrap> <div class=md-sidebar__inner> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <label class=md-nav__title for=__toc> <span class="md-nav__icon md-icon"></span> Table of contents </label> <ul class=md-nav__list data-md-component=toc data-md-scrollfix> <li class=md-nav__item> <a href=#special-parameters class=md-nav__link> <span class=md-ellipsis> Special Parameters </span> </a> </li> <li class=md-nav__item> <a href=#shell-variables class=md-nav__link> <span class=md-ellipsis> Shell Variables </span> </a> <nav class=md-nav aria-label="Shell Variables"> <ul class=md-nav__list> <li class=md-nav__item> <a href=#bash class=md-nav__link> <span class=md-ellipsis> BASH </span> </a> </li> <li class=md-nav__item> <a href=#bashopts class=md-nav__link> <span class=md-ellipsis> BASHOPTS </span> </a> </li> <li class=md-nav__item> <a href=#bashpid class=md-nav__link> <span class=md-ellipsis> BASHPID </span> </a> </li> <li class=md-nav__item> <a href=#bash_aliases class=md-nav__link> <span class=md-ellipsis> BASH_ALIASES </span> </a> </li> <li class=md-nav__item> <a href=#bash_argc class=md-nav__link> <span class=md-ellipsis> BASH_ARGC </span> </a> </li> <li class=md-nav__item> <a href=#bash_argv class=md-nav__link> <span class=md-ellipsis> BASH_ARGV </span> </a> </li> <li class=md-nav__item> <a href=#bash_argv0 class=md-nav__link> <span class=md-ellipsis> BASH_ARGV0 </span> </a> </li> <li class=md-nav__item> <a href=#bash_cmds class=md-nav__link> <span class=md-ellipsis> BASH_CMDS </span> </a> </li> <li class=md-nav__item> <a href=#bash_command class=md-nav__link> <span class=md-ellipsis> BASH_COMMAND </span> </a> </li> <li class=md-nav__item> <a href=#bash_compat class=md-nav__link> <span class=md-ellipsis> BASH_COMPAT </span> </a> </li> <li class=md-nav__item> <a href=#bash_execution_string class=md-nav__link> <span class=md-ellipsis> BASH_EXECUTION_STRING </span> </a> </li> <li class=md-nav__item> <a href=#bash_lineno class=md-nav__link> <span class=md-ellipsis> BASH_LINENO </span> </a> </li> <li class=md-nav__item> <a href=#bash_rematch class=md-nav__link> <span class=md-ellipsis> BASH_REMATCH </span> </a> </li> <li class=md-nav__item> <a href=#bash_source class=md-nav__link> <span class=md-ellipsis> BASH_SOURCE </span> </a> </li> <li class=md-nav__item> <a href=#bash_subshell class=md-nav__link> <span class=md-ellipsis> BASH_SUBSHELL </span> </a> </li> <li class=md-nav__item> <a href=#bash_versinfo class=md-nav__link> <span class=md-ellipsis> BASH_VERSINFO </span> </a> </li> <li class=md-nav__item> <a href=#bash_version class=md-nav__link> <span class=md-ellipsis> BASH_VERSION </span> </a> </li> <li class=md-nav__item> <a href=#child_max class=md-nav__link> <span class=md-ellipsis> CHILD_MAX </span> </a> </li> <li class=md-nav__item> <a href=#comp_cword class=md-nav__link> <span class=md-ellipsis> COMP_CWORD </span> </a> </li> <li class=md-nav__item> <a href=#comp_key class=md-nav__link> <span class=md-ellipsis> COMP_KEY </span> </a> </li> <li class=md-nav__item> <a href=#comp_line class=md-nav__link> <span class=md-ellipsis> COMP_LINE </span> </a> </li> <li class=md-nav__item> <a href=#comp_point class=md-nav__link> <span class=md-ellipsis> COMP_POINT </span> </a> </li> <li class=md-nav__item> <a href=#comp_type class=md-nav__link> <span class=md-ellipsis> COMP_TYPE </span> </a> </li> <li class=md-nav__item> <a href=#comp_wordbreaks class=md-nav__link> <span class=md-ellipsis> COMP_WORDBREAKS </span> </a> </li> <li class=md-nav__item> <a href=#comp_words class=md-nav__link> <span class=md-ellipsis> COMP_WORDS </span> </a> </li> <li class=md-nav__item> <a href=#coproc class=md-nav__link> <span class=md-ellipsis> COPROC </span> </a> </li> <li class=md-nav__item> <a href=#dirstack class=md-nav__link> <span class=md-ellipsis> DIRSTACK </span> </a> </li> <li class=md-nav__item> <a href=#epochrealtime class=md-nav__link> <span class=md-ellipsis> EPOCHREALTIME </span> </a> </li> <li class=md-nav__item> <a href=#epochseconds class=md-nav__link> <span class=md-ellipsis> EPOCHSECONDS </span> </a> </li> <li class=md-nav__item> <a href=#euid class=md-nav__link> <span class=md-ellipsis> EUID </span> </a> </li> <li class=md-nav__item> <a href=#funcname class=md-nav__link> <span class=md-ellipsis> FUNCNAME </span> </a> </li> <li class=md-nav__item> <a href=#groups class=md-nav__link> <span class=md-ellipsis> GROUPS </span> </a> </li> <li class=md-nav__item> <a href=#histcmd class=md-nav__link> <span class=md-ellipsis> HISTCMD </span> </a> </li> <li class=md-nav__item> <a href=#hostname class=md-nav__link> <span class=md-ellipsis> HOSTNAME </span> </a> </li> <li class=md-nav__item> <a href=#hosttype class=md-nav__link> <span class=md-ellipsis> HOSTTYPE </span> </a> </li> <li class=md-nav__item> <a href=#lineno class=md-nav__link> <span class=md-ellipsis> LINENO </span> </a> </li> <li class=md-nav__item> <a href=#machtype class=md-nav__link> <span class=md-ellipsis> MACHTYPE </span> </a> </li> <li class=md-nav__item> <a href=#mapfile class=md-nav__link> <span class=md-ellipsis> MAPFILE </span> </a> </li> <li class=md-nav__item> <a href=#oldpwd class=md-nav__link> <span class=md-ellipsis> OLDPWD </span> </a> </li> <li class=md-nav__item> <a href=#optarg class=md-nav__link> <span class=md-ellipsis> OPTARG </span> </a> </li> <li class=md-nav__item> <a href=#optind class=md-nav__link> <span class=md-ellipsis> OPTIND </span> </a> </li> <li class=md-nav__item> <a href=#ostype class=md-nav__link> <span class=md-ellipsis> OSTYPE </span> </a> </li> <li class=md-nav__item> <a href=#pipestatus class=md-nav__link> <span class=md-ellipsis> PIPESTATUS </span> </a> </li> <li class=md-nav__item> <a href=#ppid class=md-nav__link> <span class=md-ellipsis> PPID </span> </a> </li> <li class=md-nav__item> <a href=#pwd class=md-nav__link> <span class=md-ellipsis> PWD </span> </a> </li> <li class=md-nav__item> <a href=#random class=md-nav__link> <span class=md-ellipsis> RANDOM </span> </a> </li> <li class=md-nav__item> <a href=#readline_line class=md-nav__link> <span class=md-ellipsis> READLINE_LINE </span> </a> </li> <li class=md-nav__item> <a href=#readline_point class=md-nav__link> <span class=md-ellipsis> READLINE_POINT </span> </a> </li> <li class=md-nav__item> <a href=#reply class=md-nav__link> <span class=md-ellipsis> REPLY </span> </a> </li> <li class=md-nav__item> <a href=#seconds class=md-nav__link> <span class=md-ellipsis> SECONDS </span> </a> </li> <li class=md-nav__item> <a href=#shellopts class=md-nav__link> <span class=md-ellipsis> SHELLOPTS </span> </a> </li> <li class=md-nav__item> <a href=#shlvl class=md-nav__link> <span class=md-ellipsis> SHLVL </span> </a> </li> <li class=md-nav__item> <a href=#uid class=md-nav__link> <span class=md-ellipsis> UID </span> </a> </li> <li class=md-nav__item> <a href=#bash_env class=md-nav__link> <span class=md-ellipsis> BASH_ENV </span> </a> </li> <li class=md-nav__item> <a href=#bash_xtracefd class=md-nav__link> <span class=md-ellipsis> BASH_XTRACEFD </span> </a> </li> <li class=md-nav__item> <a href=#cdpath class=md-nav__link> <span class=md-ellipsis> CDPATH </span> </a> </li> <li class=md-nav__item> <a href=#columns class=md-nav__link> <span class=md-ellipsis> COLUMNS </span> </a> </li> <li class=md-nav__item> <a href=#compreply class=md-nav__link> <span class=md-ellipsis> COMPREPLY </span> </a> </li> <li class=md-nav__item> <a href=#emacs class=md-nav__link> <span class=md-ellipsis> EMACS </span> </a> </li> <li class=md-nav__item> <a href=#env class=md-nav__link> <span class=md-ellipsis> ENV </span> </a> </li> <li class=md-nav__item> <a href=#fcedit class=md-nav__link> <span class=md-ellipsis> FCEDIT </span> </a> </li> <li class=md-nav__item> <a href=#fignore class=md-nav__link> <span class=md-ellipsis> FIGNORE </span> </a> </li> <li class=md-nav__item> <a href=#funcnest class=md-nav__link> <span class=md-ellipsis> FUNCNEST </span> </a> </li> <li class=md-nav__item> <a href=#globignore class=md-nav__link> <span class=md-ellipsis> GLOBIGNORE </span> </a> </li> <li class=md-nav__item> <a href=#histcontrol class=md-nav__link> <span class=md-ellipsis> HISTCONTROL </span> </a> </li> <li class=md-nav__item> <a href=#histfile class=md-nav__link> <span class=md-ellipsis> HISTFILE </span> </a> </li> <li class=md-nav__item> <a href=#histfilesize class=md-nav__link> <span class=md-ellipsis> HISTFILESIZE </span> </a> </li> <li class=md-nav__item> <a href=#histignore class=md-nav__link> <span class=md-ellipsis> HISTIGNORE </span> </a> </li> <li class=md-nav__item> <a href=#histsize class=md-nav__link> <span class=md-ellipsis> HISTSIZE </span> </a> </li> <li class=md-nav__item> <a href=#histtimeformat class=md-nav__link> <span class=md-ellipsis> HISTTIMEFORMAT </span> </a> </li> <li class=md-nav__item> <a href=#home class=md-nav__link> <span class=md-ellipsis> HOME </span> </a> </li> <li class=md-nav__item> <a href=#hostfile class=md-nav__link> <span class=md-ellipsis> HOSTFILE </span> </a> </li> <li class=md-nav__item> <a href=#ifs class=md-nav__link> <span class=md-ellipsis> IFS </span> </a> </li> <li class=md-nav__item> <a href=#ignoreeof class=md-nav__link> <span class=md-ellipsis> IGNOREEOF </span> </a> </li> <li class=md-nav__item> <a href=#inputrc class=md-nav__link> <span class=md-ellipsis> INPUTRC </span> </a> </li> <li class=md-nav__item> <a href=#lang class=md-nav__link> <span class=md-ellipsis> LANG </span> </a> </li> <li class=md-nav__item> <a href=#lc_all class=md-nav__link> <span class=md-ellipsis> LC_ALL </span> </a> </li> <li class=md-nav__item> <a href=#lc_collate class=md-nav__link> <span class=md-ellipsis> LC_COLLATE </span> </a> </li> <li class=md-nav__item> <a href=#lc_ctype class=md-nav__link> <span class=md-ellipsis> LC_CTYPE </span> </a> </li> <li class=md-nav__item> <a href=#lc_messages class=md-nav__link> <span class=md-ellipsis> LC_MESSAGES </span> </a> </li> <li class=md-nav__item> <a href=#lc_numeric class=md-nav__link> <span class=md-ellipsis> LC_NUMERIC </span> </a> </li> <li class=md-nav__item> <a href=#lines class=md-nav__link> <span class=md-ellipsis> LINES </span> </a> </li> <li class=md-nav__item> <a href=#mail class=md-nav__link> <span class=md-ellipsis> MAIL </span> </a> </li> <li class=md-nav__item> <a href=#mailcheck class=md-nav__link> <span class=md-ellipsis> MAILCHECK </span> </a> </li> <li class=md-nav__item> <a href=#mailpath class=md-nav__link> <span class=md-ellipsis> MAILPATH </span> </a> </li> <li class=md-nav__item> <a href=#opterr class=md-nav__link> <span class=md-ellipsis> OPTERR </span> </a> </li> <li class=md-nav__item> <a href=#path class=md-nav__link> <span class=md-ellipsis> PATH </span> </a> </li> <li class=md-nav__item> <a href=#posixly_correct class=md-nav__link> <span class=md-ellipsis> POSIXLY_CORRECT </span> </a> </li> <li class=md-nav__item> <a href=#prompt_command class=md-nav__link> <span class=md-ellipsis> PROMPT_COMMAND </span> </a> </li> <li class=md-nav__item> <a href=#prompt_commands class=md-nav__link> <span class=md-ellipsis> PROMPT_COMMANDS </span> </a> </li> <li class=md-nav__item> <a href=#prompt_dirtrim class=md-nav__link> <span class=md-ellipsis> PROMPT_DIRTRIM </span> </a> </li> <li class=md-nav__item> <a href=#ps0 class=md-nav__link> <span class=md-ellipsis> PS0 </span> </a> </li> <li class=md-nav__item> <a href=#ps1 class=md-nav__link> <span class=md-ellipsis> PS1 </span> </a> </li> <li class=md-nav__item> <a href=#ps2 class=md-nav__link> <span class=md-ellipsis> PS2 </span> </a> </li> <li class=md-nav__item> <a href=#ps3 class=md-nav__link> <span class=md-ellipsis> PS3 </span> </a> </li> <li class=md-nav__item> <a href=#ps4 class=md-nav__link> <span class=md-ellipsis> PS4 </span> </a> </li> <li class=md-nav__item> <a href=#shell class=md-nav__link> <span class=md-ellipsis> SHELL </span> </a> </li> <li class=md-nav__item> <a href=#srandom class=md-nav__link> <span class=md-ellipsis> SRANDOM </span> </a> </li> <li class=md-nav__item> <a href=#timeformat class=md-nav__link> <span class=md-ellipsis> TIMEFORMAT </span> </a> </li> <li class=md-nav__item> <a href=#tmout class=md-nav__link> <span class=md-ellipsis> TMOUT </span> </a> </li> <li class=md-nav__item> <a href=#tmpdir class=md-nav__link> <span class=md-ellipsis> TMPDIR </span> </a> </li> <li class=md-nav__item> <a href=#auto_resume class=md-nav__link> <span class=md-ellipsis> auto_resume </span> </a> </li> <li class=md-nav__item> <a href=#histchars class=md-nav__link> <span class=md-ellipsis> histchars </span> </a> </li> </ul> </nav> </li> </ul> </nav> </div> </div> </div> <div class=md-content data-md-component=content> <article class="md-content__inner md-typeset"> <a href=https://github.com/flokoe/bash-hackers-wiki/edit/main/docs/syntax/shellvars.md title="Edit this page" class="md-content__button md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M10 20H6V4h7v5h5v3.1l2-2V8l-6-6H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h4zm10.2-7c.1 0 .3.1.4.2l1.3 1.3c.2.2.2.6 0 .8l-1 1-2.1-2.1 1-1c.1-.1.2-.2.4-.2m0 3.9L14.1 23H12v-2.1l6.1-6.1z"/></svg> </a> <a href=https://github.com/flokoe/bash-hackers-wiki/raw/main/docs/syntax/shellvars.md title="View source of this page" class="md-content__button md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M17 18c.56 0 1 .44 1 1s-.44 1-1 1-1-.44-1-1 .44-1 1-1m0-3c-2.73 0-5.06 1.66-6 4 .94 2.34 3.27 4 6 4s5.06-1.66 6-4c-.94-2.34-3.27-4-6-4m0 6.5a2.5 2.5 0 0 1-2.5-2.5 2.5 2.5 0 0 1 2.5-2.5 2.5 2.5 0 0 1 2.5 2.5 2.5 2.5 0 0 1-2.5 2.5M9.27 20H6V4h7v5h5v4.07c.7.08 1.36.25 2 .49V8l-6-6H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4.5a8.2 8.2 0 0 1-1.23-2"/></svg> </a> <h1 id=special-parameters-and-shell-variables>Special parameters and shell variables<a class=headerlink href=#special-parameters-and-shell-variables title="Permanent link">&para;</a></h1> <h2 id=special-parameters>Special Parameters<a class=headerlink href=#special-parameters title="Permanent link">&para;</a></h2> <table> <thead> <tr> <th>parameter</th> <th>character</th> <th>expansion description</th> </tr> </thead> <tbody> <tr> <td><code>*</code></td> <td>asterisk</td> <td>The positional parameters starting from the first. When used inside doublequotes (see <a href=../syntax/quoting>quoting</a>), like <code>"$*"</code>, it expands to all positional parameters <em>as one word</em>, delimited by the first character of the <code>IFS</code> variable (a space in this example): <code>"$1 $2 $3 $4"</code>.<br>If <code>IFS</code> is unset, the delimiter used will be always a space, if <code>IFS</code> is NULL, the delimiter will be nothing, which effectively concatenates all the positional parameters without any delimiter.<br>When used unquoted, it will just expand to the strings, one by one, not preserving the word boundaries (i.e. word splitting will split the text again, if it contains <code>IFS</code> characters.<br>See also the <a href=../scripting/posparams>scripting article about handling positional parameters</a>.</td> </tr> <tr> <td><code>@</code></td> <td>at-sign</td> <td>The positional parameters starting from the first. When used inside doublequotes (see <a href=../syntax/quoting>quoting</a>), like <code>"$@"</code>, it expands all positional parameters <em>as separate words</em>: <code>"$1" "$2" "$3" "$4"</code><br>Without doublequotes, the behaviour is like the one of <code>*</code> without doublequotes.<br>See also the <a href=../scripting/posparams>scripting article about handling positional parameters</a>.</td> </tr> <tr> <td><code>#</code></td> <td>hash mark</td> <td>Number of positional parameters (decimal)<br>See also the <a href=../scripting/posparams>scripting article about handling positional parameters</a>.</td> </tr> <tr> <td><code>?</code></td> <td>question mark</td> <td>Status of the most recently executed foreground-pipeline (exit/return code)</td> </tr> <tr> <td><code>-</code></td> <td>dash</td> <td>Current option flags set by the shell itself, on invocation, or using the <a href=../commands/builtin/set>set builtin command</a>. It\'s just a set of characters, like <code>himB</code> for <code>h</code>, <code>i</code>, <code>m</code> and <code>B</code>.</td> </tr> <tr> <td><code>$</code></td> <td>dollar-sign</td> <td>The process ID (PID) of the shell. In an <a href=../syntax/ccmd/grouping_subshell>explicit subshell</a> it expands to the PID of the current \"main shell\", not the subshell. This is different from <code>$BASHPID</code>!</td> </tr> <tr> <td><code>!</code></td> <td>exclamation mark</td> <td>The process ID (PID) of the most recently executed background pipeline (like started with <code>command &amp;</code>)</td> </tr> <tr> <td><code>0</code></td> <td>zero</td> <td>The name of the shell or the shell script (filename). Set by the shell itself.<br>If Bash is started with a filename to execute (script), it\'s set to this filename. If started with the <code>-c &lt;CMDLINE&gt;</code> option (commandline given as argument), then <code>$0</code> will be the first argument after the given <code>&lt;CMDLINE&gt;</code>. Otherwise, it is set to the string given on invocation for <code>argv[0]</code>.<br>Unlike popular belief, <code>$0</code> is <em>not a positional parameter</em>.</td> </tr> <tr> <td><code>_</code></td> <td>underscore</td> <td>A kind of catch-all parameter. Directly after shell invocation, it\'s set to the filename used to invoke Bash, or the absolute or relative path to the script, just like <code>$0</code> would show it. Subsequently, expands to the last argument to the previous command. Placed into the environment when executing commands, and set to the full pathname of these commands. When checking mail, this parameter holds the name of the mail file currently being checked.</td> </tr> </tbody> </table> <h2 id=shell-variables>Shell Variables<a class=headerlink href=#shell-variables title="Permanent link">&para;</a></h2> <h3 id=bash>BASH<a class=headerlink href=#bash title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Expands to the full file name used to invoke the current instance of Bash.</p> <h3 id=bashopts>BASHOPTS<a class=headerlink href=#bashopts title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASHOPTS</code></th> <th>Since:</th> <th>4.1-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>yes</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>A colon-separated list of enabled shell options.</p> <p>Each word in the list is a valid argument for the <code>-s</code> option to the <a href=../../commands/builtin/shopt/ >shopt builtin command</a>. The options appearing in <code>BASHOPTS</code> are those reported as on by <code>shopt</code>. If this variable is in the environment when Bash starts up, each shell option in the list will be enabled before reading any startup files.</p> <p>Example content:</p> <div class=highlight><pre><span></span><code>cmdhist:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
</code></pre></div> <p>This variable is read-only.</p> <h3 id=bashpid>BASHPID<a class=headerlink href=#bashpid title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASHPID</code></th> <th>Since:</th> <th>4.0-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>yes</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Always expands to the process ID of the current Bash process. This differs from the special parameter <code>$</code> under certain circumstances, such as subshells that do not require Bash to be re-initialized.</p> <h3 id=bash_aliases>BASH_ALIASES<a class=headerlink href=#bash_aliases title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_ALIASES</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>associative array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An associative array variable whose members correspond to the internal list of aliases as maintained by the alias builtin. Elements added to this array appear in the alias list; unsetting array elements cause aliases to be removed from the alias list.</p> <p>The associative key is the name of the alias as used with the <code>alias</code> builtin command.</p> <h3 id=bash_argc>BASH_ARGC<a class=headerlink href=#bash_argc title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_ARGC</code></th> <th>Since:</th> <th>3.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>only in extended debugging mode</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable whose values are the number of parameters in each frame of the current Bash execution call stack.</p> <p>The number of parameters to the current subroutine (shell function or script executed with <code>.</code> or <code>source</code> builtin command) is at the top of the stack. When a subroutine is executed, the number of parameters passed is pushed onto <code>BASH_ARGC</code>.</p> <h3 id=bash_argv>BASH_ARGV<a class=headerlink href=#bash_argv title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_ARGV</code></th> <th>Since:</th> <th>3.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>only in extended debugging mode</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable containing all of the parameters in the current Bash execution call stack.</p> <p>The final parameter of the last subroutine call is at the top of the stack; the first parameter of the initial call is at the bottom. When a subroutine is executed, the parameters supplied are pushed onto <code>BASH_ARGV</code>.</p> <h3 id=bash_argv0>BASH_ARGV0<a class=headerlink href=#bash_argv0 title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_ARGV0</code></th> <th>Since:</th> <th>5.0-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>string</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>same as <code>$0</code></td> </tr> </tbody> </table> <p>Expands to the name of the shell or shell script - as the special parameter <code>$0</code> does. Assignments to <code>BASH_ARGV0</code> causes the value to be assigned to <code>$0</code>.</p> <p>If this parameter is unset, it loses its special properties, even if subsequently reset.</p> <h3 id=bash_cmds>BASH_CMDS<a class=headerlink href=#bash_cmds title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_CMDS</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>associative array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An associative array variable whose members correspond to the internal hash table of commands as maintained by the <code>hash</code> builtin command. Elements added to this array appear in the hash table; unsetting array elements cause commands to be removed from the hash table.</p> <p>The associative key is the name of the command as used with the <code>hash</code> builtin command.</p> <h3 id=bash_command>BASH_COMMAND<a class=headerlink href=#bash_command title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_COMMAND</code></th> <th>Since:</th> <th>3.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The command currently being executed or about to be executed, unless the shell is executing a command as the result of a trap, in which case it is the command executing at the time of the trap.</p> <h3 id=bash_compat>BASH_COMPAT<a class=headerlink href=#bash_compat title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_COMPAT</code></th> <th>Since:</th> <th>4.3-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The value is used to set the shell's compatibility level. The value may be a decimal number (e.g., <code>4.2</code>) or an integer (e.g., <code>42</code>) corresponding to the desired compatibility level. If <code>BASH_COMPAT</code> is unset or set to the empty string, the compatibility level is set to the default for the current version. If <code>BASH_COMPAT</code> is set to a value that is not one of the valid compatibility levels, the shell prints an error message and sets the compatibility level to the default for the current version. The valid compatibility levels correspond to the compatibility options accepted by the shopt builtin. The current version is also a valid value.</p> <h3 id=bash_execution_string>BASH_EXECUTION_STRING<a class=headerlink href=#bash_execution_string title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_EXECUTION_STRING</code></th> <th>Since:</th> <th>3.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The command argument to the <code>-c</code> invocation option.</p> <h3 id=bash_lineno>BASH_LINENO<a class=headerlink href=#bash_lineno title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_LINENO</code></th> <th>Since:</th> <th>3.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable whose members are the line numbers in source files corresponding to each member of <code>FUNCNAME</code>.</p> <p><code>${BASH_LINENO[$i]}</code> is the line number in the source file where <code>${FUNCNAME[$ifP]}</code> was called. The corresponding source file name is <code>${BASH_SOURCE[$i]}</code>. Use <code>LINENO</code> to obtain the current line number.</p> <h3 id=bash_rematch>BASH_REMATCH<a class=headerlink href=#bash_rematch title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_REMATCH</code></th> <th>Since:</th> <th>3.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable whose members are assigned by the <code>=~</code> binary operator to the <code>[[</code> conditional command.</p> <p>The element with index 0 is the portion of the string matching the entire regular expression. The element with index <code>n</code> is the portion of the string matching the nth parenthesized subexpression.</p> <p>Before Bash version 5.1-alpha this variable was readonly.</p> <h3 id=bash_source>BASH_SOURCE<a class=headerlink href=#bash_source title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_SOURCE</code></th> <th>Since:</th> <th>3.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer</td> <td>indexed</td> <td>array Read-only: no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable whose members are the source filenames corresponding to the elements in the <code>FUNCNAME</code> array variable.</p> <h3 id=bash_subshell>BASH_SUBSHELL<a class=headerlink href=#bash_subshell title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_SUBSHELL</code></th> <th>Since:</th> <th>3.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Incremented by one each time a subshell or subshell environment is spawned. The initial value is 0.</p> <h3 id=bash_versinfo>BASH_VERSINFO<a class=headerlink href=#bash_versinfo title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_VERSINFO</code></th> <th>Since:</th> <th>2.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>yes</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>A readonly array variable whose members hold version information for this instance of Bash. The values assigned to the array members are as follows:</p> <table> <thead> <tr> <th>--</th> <th>--</th> </tr> </thead> <tbody> <tr> <td>BASH_VERSINFO[0]</td> <td>The major version number (the release)</td> </tr> <tr> <td>BASH_VERSINFO[1]</td> <td>The minor version number (the version)</td> </tr> <tr> <td>BASH_VERSINFO[2]</td> <td>The patch level</td> </tr> <tr> <td>BASH_VERSINFO[3]</td> <td>The build version</td> </tr> <tr> <td>BASH_VERSINFO[4]</td> <td>The release status (e.g., beta1)</td> </tr> <tr> <td>BASH_VERSINFO[5]</td> <td>The value of <code>MACHTYPE</code></td> </tr> </tbody> </table> <h3 id=bash_version>BASH_VERSION<a class=headerlink href=#bash_version title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_VERSION</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Expands to a string describing the version of this instance of Bash.</p> <p>Since Bash 2.0 it includes the shell's "release status" (alpha[N], beta[N], release).</p> <h3 id=child_max>CHILD_MAX<a class=headerlink href=#child_max title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>CHILD_MAX</code></th> <th>Since:</th> <th>4.3-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Set the number of exited child status values for the shell to remember. Bash will not allow this value to be decreased below a POSIX-mandated minimum, and there is a maximum value (currently 8192) that this may not exceed. The minimum value is system-dependent.</p> <h3 id=comp_cword>COMP_CWORD<a class=headerlink href=#comp_cword title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>COMP_CWORD</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>only for programmable completion facilities</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An index into <code>COMP_WORDS</code> of the word containing the current cursor position.</p> <h3 id=comp_key>COMP_KEY<a class=headerlink href=#comp_key title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>COMP_KEY</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>only for programmable completion facilities</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The key (or final key of a key sequence) used to invoke the current completion function.</p> <h3 id=comp_line>COMP_LINE<a class=headerlink href=#comp_line title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>COMP_LINE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>only for programmable completion facilities</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The current command line.</p> <h3 id=comp_point>COMP_POINT<a class=headerlink href=#comp_point title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>COMP_POINT</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>only for programmable completion facilities</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The index of the current cursor position relative to the beginning of the current command. If the current cursor position is at the end of the current command, the value of this variable is equal to <code>${#COMP_LINE}</code>.</p> <h3 id=comp_type>COMP_TYPE<a class=headerlink href=#comp_type title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>COMP_TYPET</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>only for programmable completion facilities</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Set to an integer value corresponding to the type of completion attempted that caused a completion function to be called:</p> <table> <thead> <tr> <th>--</th> <th>--</th> </tr> </thead> <tbody> <tr> <td><code>TAB</code></td> <td>normal completion</td> </tr> <tr> <td><code>?</code></td> <td>listing completions after successive tabs</td> </tr> <tr> <td><code>!</code></td> <td>listing alternatives on partial word completion</td> </tr> <tr> <td><code>@</code></td> <td>to list completions if the word is not unmodified</td> </tr> <tr> <td><code>%</code></td> <td>for menu completion</td> </tr> </tbody> </table> <div class="admonition warning"> <p class=admonition-title>FIXME</p> <p>where are the integer values?</p> </div> <h3 id=comp_wordbreaks>COMP_WORDBREAKS<a class=headerlink href=#comp_wordbreaks title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>COMP_WORDBREAKS</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Reports the set of characters that the readline library treats as word separators when performing word completion.</p> <p>If this parameter is unset, it loses its special properties, even if it is subsequently reset.</p> <h3 id=comp_words>COMP_WORDS<a class=headerlink href=#comp_words title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>COMP_WORDS</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>only for programmable completion facilities</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable consisting of the individual words in the current command line. The line is split into words as readline would split it, using <code>COMP_WORDBREAKS</code> as described above.</p> <h3 id=coproc>COPROC<a class=headerlink href=#coproc title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>COPROC</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable created to hold the file descriptors for output from and input to an unnamed coprocess.</p> <h3 id=dirstack>DIRSTACK<a class=headerlink href=#dirstack title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>DIRSTACK</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable containing the current contents of the directory stack.</p> <p>Directories appear in the stack in the order they are displayed by the dirs builtin. Assigning to members of this array variable may be used to modify directories already in the stack, but the pushd and popd builtins must be used to add and remove directories.</p> <p>Assignment to this variable will not change the current directory.</p> <p>If this parameter is unset, it loses its special properties, even if it is subsequently reset.</p> <h3 id=epochrealtime>EPOCHREALTIME<a class=headerlink href=#epochrealtime title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>EPOCHREALTIME</code></th> <th>Since:</th> <th>5.0-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Expands to the number of seconds since Unix expoch as a floating point value with micro-second granularity.</p> <p>Assignments to this parameter are ignored. If this parameter is unset, it loses its special properties, even if it is subsequently reset.</p> <h3 id=epochseconds>EPOCHSECONDS<a class=headerlink href=#epochseconds title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>EPOCHSECONDS</code></th> <th>Since:</th> <th>5.0-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Expands to the number of seconds since Unix expoch.</p> <p>Assignments to this parameter are ignored. If this parameter is unset, it loses its special properties, even if it is subsequently reset.</p> <h3 id=euid>EUID<a class=headerlink href=#euid title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>EUID</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>yes</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Expands to the effective user ID of the current user, initialized at shell startup.</p> <div class="admonition danger"> <p class=admonition-title>!</p> <p>Do not rely on this variable when security is a concern.</p> </div> <h3 id=funcname>FUNCNAME<a class=headerlink href=#funcname title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>FUNCNAME</code></th> <th>Since:</th> <th>2.04</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>only inside shell functions</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable containing the names of all shell functions currently in the execution call stack.</p> <p>The element with index 0 is the name of any currently-executing shell function. The bottom-most element (the one with the highest index) is "main".</p> <p>This variable can be used with <code>BASH_LINENO</code> and <code>BASH_SOURCE</code>: Each element of <code>FUNCNAME</code> has corresponding elements in <code>BASH_LINENO</code> and <code>BASH_SOURCE</code> to describe the call stack. For instance, <code>${FUNCNAME[$i]}</code> was called from the file <code>${BASH_SOURCE[$i+1]}</code> at line number <code>${BASH_LINENO[$i]}</code>. The <a href=../../commands/builtin/caller/ >caller builtin command</a> displays the current call stack using this information.</p> <p>This variable exists only when a shell function is executing.</p> <p>Assignments to this parameter have no effect and return an error status.</p> <p>If this parameter is unset, it loses its special properties, even if it is subsequently reset.</p> <h3 id=groups>GROUPS<a class=headerlink href=#groups title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>GROUPS</code></th> <th>Since:</th> <th>2.01</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable containing the list of groups of which the current user is a member.</p> <p>Assignments to this parameter have no effect and return an error status.</p> <p>If this parameter is unset, it loses its special properties, even if it is subsequently reset.</p> <h3 id=histcmd>HISTCMD<a class=headerlink href=#histcmd title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HISTCMD</code></th> <th>Since:</th> <th>1.14.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Expands to the history number (index in the history list) of the current command.</p> <p>If this parameter is unset, it loses its special properties, even if it is subsequently reset.</p> <h3 id=hostname>HOSTNAME<a class=headerlink href=#hostname title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HOSTNAME</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Automatically set to the name of the current host.</p> <h3 id=hosttype>HOSTTYPE<a class=headerlink href=#hosttype title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HOSTTYPE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>system-dependent</td> </tr> </tbody> </table> <p>Automatically set to a string that uniquely describes the type of machine on which Bash is executing.</p> <p>Example content:</p> <div class=highlight><pre><span></span><code>x86_64
</code></pre></div> <h3 id=lineno>LINENO<a class=headerlink href=#lineno title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>LINENO</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Each time this parameter is referenced, the shell substitutes a decimal number representing the current sequential line number (starting with 1) within a script or function.</p> <p>When not in a script or function, the value substituted is not guaranteed to be meaningful.</p> <p>If this parameter is unset, it loses its special properties, even if it is subsequently reset.</p> <h3 id=machtype>MACHTYPE<a class=headerlink href=#machtype title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>MACHTYPE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>system-dependent</td> </tr> </tbody> </table> <p>Automatically set to a string that fully describes the system type on which Bash is executing, in the standard GNU "cpu-company-system" format.</p> <p>Example content:</p> <div class=highlight><pre><span></span><code>x86_64-unknown-linux-gnu
</code></pre></div> <h3 id=mapfile>MAPFILE<a class=headerlink href=#mapfile title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>MAPFILE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable created to hold the text read by the <a href=../../commands/builtin/mapfile/ >mapfile builtin command</a> when no variable name is supplied.</p> <h3 id=oldpwd>OLDPWD<a class=headerlink href=#oldpwd title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>OLDPWD</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The previous working directory as set by the cd command.</p> <h3 id=optarg>OPTARG<a class=headerlink href=#optarg title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>OPTARG</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The value of the last option argument processed by the <code>getopts</code> builtin command.</p> <h3 id=optind>OPTIND<a class=headerlink href=#optind title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>OPTIND</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The index of the next argument to be processed by the <code>getopts</code> builtin command.</p> <h3 id=ostype>OSTYPE<a class=headerlink href=#ostype title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>OSTYPE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>system-dependent</td> </tr> </tbody> </table> <p>Automatically set to a string that describes the operating system on which Bash is executing.</p> <p>Example content:</p> <div class=highlight><pre><span></span><code>linux-gnu
</code></pre></div> <h3 id=pipestatus>PIPESTATUS<a class=headerlink href=#pipestatus title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PIPESTATUS</code></th> <th>Since:</th> <th>2.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable containing a list of exit status values from the processes in the most-recently-executed foreground pipeline (which may contain only a single command).</p> <h3 id=ppid>PPID<a class=headerlink href=#ppid title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PPID</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>yes</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The process ID of the shell's parent process.</p> <h3 id=pwd>PWD<a class=headerlink href=#pwd title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PWD</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The current working directory as set by the <a href=../../commands/builtin/cd/ >cd builtin command</a>.</p> <h3 id=random>RANDOM<a class=headerlink href=#random title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>RANDOM</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Each time this parameter is referenced, a random integer between 0 and 32767 is generated. The sequence of random numbers may be initialized by assigning a value to <code>RANDOM</code>.</p> <p>If this parameter is unset, it loses its special properties, even if it is subsequently reset.</p> <h3 id=readline_line>READLINE_LINE<a class=headerlink href=#readline_line title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>READLINE_LINE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The contents of the readline line buffer, for use with <code>bind -x</code>.</p> <h3 id=readline_point>READLINE_POINT<a class=headerlink href=#readline_point title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>READLINE_POINT</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The position of the insertion point in the readline line buffer, for use with <code>bind -x</code>.</p> <h3 id=reply>REPLY<a class=headerlink href=#reply title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>REPLY</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>only by the <a href=../../commands/builtin/read/ >read builtin command</a></td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Set to the line of input read by the <a href=../../commands/builtin/read/ >read builtin command</a> when no arguments are supplied that name target variables.</p> <h3 id=seconds>SECONDS<a class=headerlink href=#seconds title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>SECONDS</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Each time this parameter is referenced, the number of seconds since shell invocation is returned. If a value is assigned to SECONDS, the value returned upon subsequent references is the number of seconds since the assignment plus the value assigned.</p> <p>If this parameter is unset, it loses its special properties, even if it is subsequently reset.</p> <h3 id=shellopts>SHELLOPTS<a class=headerlink href=#shellopts title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>SHELLOPTS</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>yes</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>A colon-separated list of enabled shell options. Each word in the list is a valid argument for the <code>-o</code> option to the <a href=../../commands/builtin/set/ >set builtin command</a>. The options appearing in <code>SHELLOPTS</code> are those reported as on by <code>set -o</code>.</p> <p>If this variable is in the environment when Bash starts up, each shell option in the list will be enabled before reading any startup files.</p> <h3 id=shlvl>SHLVL<a class=headerlink href=#shlvl title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>SHLVL</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Incremented by one each time an instance of Bash is started.</p> <h3 id=uid>UID<a class=headerlink href=#uid title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>UID</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer variable</td> <td>Read-only:</td> <td>yes</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Expands to the user ID of the current user, initialized at shell startup.</p> <p>:!: Do not rely on this variable when security is a concern.</p> <h3 id=bash_env>BASH_ENV<a class=headerlink href=#bash_env title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_ENV</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If this parameter is set when Bash is executing a shell script, its value is interpreted as a filename containing commands to initialize the shell, as in <code>~/.bashrc</code>. The value of <code>BASH_ENV</code> is subjected to</p> <ul> <li><a href=../pe/ >parameter expansion</a></li> <li><a href=../expansion/cmdsubst/ >command substitution</a></li> <li><a href=../expansion/arith/ >arithmetic expansion</a></li> </ul> <p>before being interpreted as a file name.</p> <p><code>PATH</code> is not used to search for the resultant file name.</p> <h3 id=bash_xtracefd>BASH_XTRACEFD<a class=headerlink href=#bash_xtracefd title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>BASH_XTRACEFD</code></th> <th>Since:</th> <th>4.1-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If set to an integer corresponding to a valid file descriptor, Bash will write the trace output generated when <code>set -x</code> is enabled to that file descriptor.</p> <p>The file descriptor is closed when <code>BASH_XTRACEFD</code> is unset or assigned a new value.</p> <p>Unsetting <code>BASH_XTRACEFD</code> or assigning it the empty string causes the trace output to be sent to the standard error. Note that setting <code>BASH_XTRACEFD</code> to 2 (the standard error file descriptor) and then unsetting it will result in the standard error being closed.</p> <h3 id=cdpath>CDPATH<a class=headerlink href=#cdpath title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>CDPATH</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The search path for the <a href=../../commands/builtin/cd/ >cd builtin command</a>.</p> <p>This is a colon-separated list of directories in which the shell looks for destination directories specified by the <code>cd</code> command.</p> <p>Example content:</p> <div class=highlight><pre><span></span><code>.:~:/usr
</code></pre></div> <h3 id=columns>COLUMNS<a class=headerlink href=#columns title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>COLUMNS</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>on <code>|SIGWINCH</code> Default:</td> <td>n/a</td> <td></td> </tr> </tbody> </table> <p>Used by the select compound command to determine the terminal width when printing selection lists. Automatically set upon receipt of a <code>SIGWINCH</code>.</p> <h3 id=compreply>COMPREPLY<a class=headerlink href=#compreply title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>COMPREPLY</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>An array variable from which Bash reads the possible completions generated by a shell function invoked by the programmable completion facility.</p> <h3 id=emacs>EMACS<a class=headerlink href=#emacs title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>EMACS</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If Bash finds this variable in the environment when the shell starts with value "t", it assumes that the shell is running in an Emacs shell buffer and disables line editing.</p> <h3 id=env>ENV<a class=headerlink href=#env title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>ENV</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Similar to <code>BASH_ENV</code>: Used when the shell is invoked in POSIX&reg; mode.</p> <h3 id=fcedit>FCEDIT<a class=headerlink href=#fcedit title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>FCEDIT</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The default editor for the <code>fc</code> builtin command.</p> <h3 id=fignore>FIGNORE<a class=headerlink href=#fignore title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>FIGNORE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>A colon-separated list of suffixes to ignore when performing filename completion. A filename whose suffix matches one of the entries in <code>FIGNORE</code> is excluded from the list of matched filenames.</p> <p>Example content:</p> <div class=highlight><pre><span></span><code>.o:~
</code></pre></div> <h3 id=funcnest>FUNCNEST<a class=headerlink href=#funcnest title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>FUNCNEST</code></th> <th>Since:</th> <th>4.2-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If set to a numeric value greater than 0, defines a maximum function nesting level. Function invocations that exceed this nesting level will cause the current command to abort.</p> <p>Negative values, 0 or non-numeric assignments have the effect as if <code>FUNCNEST</code> was unset or empty: No nest control</p> <h3 id=globignore>GLOBIGNORE<a class=headerlink href=#globignore title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>GLOBIGNORE</code></th> <th>Since:</th> <th>2.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>A colon-separated list of patterns defining the set of filenames to be ignored by pathname expansion. If a filename matched by a pathname expansion pattern also matches one of the patterns in <code>GLOBIGNORE</code>, it is removed from the list of matches.</p> <h3 id=histcontrol>HISTCONTROL<a class=headerlink href=#histcontrol title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HISTCONTROL</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>A colon-separated list of values controlling how commands are saved on the history list:</p> <table> <thead> <tr> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td><code>ignorespace</code></td> <td>lines which begin with a space character are not saved in the history list</td> </tr> <tr> <td><code>ignoredups</code></td> <td>don't save lines matching the previous history entry</td> </tr> <tr> <td><code>ignoreboth</code></td> <td>short for <code>ignorespace:ignoredups</code></td> </tr> <tr> <td><code>erasedups</code></td> <td>remove all previous lines matching the current line from the history list before the current line is saved</td> </tr> </tbody> </table> <p>Any value not in the above list is ignored.</p> <p>If <code>HISTCONTROL</code> is unset, or does not include a valid value, all lines read by the shell parser are saved on the history list, subject to the value of <code>HISTIGNORE</code>. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of <code>HISTCONTROL</code>.</p> <h3 id=histfile>HISTFILE<a class=headerlink href=#histfile title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HISTFILE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>if unset</td> <td>Default: \'\' \~/.bash_history\'\'</td> <td></td> </tr> </tbody> </table> <p>The |name of the file in which command history is saved.|</p> <p>If unset, the command history is not saved when an interactive shell exits.</p> <h3 id=histfilesize>HISTFILESIZE<a class=headerlink href=#histfilesize title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HISTFILESIZE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>if unset</td> <td>Default: <code>HISTSIZE</code></td> <td></td> </tr> </tbody> </table> <p>The |maximum number of lines contained in the history file.|</p> <p>When this variable is assigned a value, the history file is truncated, if necessary, by removing the oldest entries, to contain no more than the given number of lines. If the given number of lines is 0 (zero), the file is truncated to zero size. Non-numeric values and numeric values less than zero inhibit truncation.</p> <p>The history file is also truncated to this size after writing it when an interactive shell exits.</p> <h3 id=histignore>HISTIGNORE<a class=headerlink href=#histignore title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HISTIGNORE</code></th> <th>Since:</th> <th>2.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>A colon-separated list of patterns used to decide which command lines should be saved on the history list. Each pattern is anchored at the beginning of the line and must match the complete line (no implicit '<code>*</code>' is appended).</p> <p>Each pattern is tested against the line after the checks specified by <code>HISTCONTROL</code> are applied.</p> <p>In addition to the normal shell pattern matching characters, "&amp;" matches the previous history line. "&amp;" may be escaped using a backslash; the backslash is removed before attempting a match.</p> <p>The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of <code>HISTIGNORE</code>.</p> <h3 id=histsize>HISTSIZE<a class=headerlink href=#histsize title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HISTSIZE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>if unset</td> <td>Default:</td> <td>set at compile time (default 500)</td> </tr> </tbody> </table> <p>The number of commands to remember in the command history.</p> <p>If the number is set to 0 (zero), then the history list is disabled. If the number is set to any negative number, then the history list is unlimited.</p> <h3 id=histtimeformat>HISTTIMEFORMAT<a class=headerlink href=#histtimeformat title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HISTTIMEFORMAT</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If this variable is set and not null, its value is used as a format string for <code>strftime(3)</code> to print the time stamp associated with each history entry displayed by the history builtin.</p> <p>If this variable is set, time stamps are written to the history file so they may be preserved across shell sessions. This uses the history comment character to distinguish timestamps from other history lines.</p> <h3 id=home>HOME<a class=headerlink href=#home title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HOME</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The home directory of the current user.</p> <p>The default argument for the <a href=../../commands/builtin/cd/ >cd builtin command</a>.</p> <p>The value of this variable is also used when performing <a href=../expansion/tilde/ >tilde expansion</a>.</p> <h3 id=hostfile>HOSTFILE<a class=headerlink href=#hostfile title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>HOSTFILE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Contains the name of a file in the same format as <code>/etc/hosts</code> that should be read when the shell needs to complete a hostname.</p> <p>The list of possible hostname completions may be changed while the shell is running. the next time hostname completion is attempted after the value is changed, Bash adds the contents of the new file to the existing list.</p> <p>If <code>HOSTFILE</code> is set, but has no value, or does not name a readable file, Bash attempts to read <code>/etc/hosts</code> to obtain the list of possible hostname completions.</p> <p>When <code>HOSTFILE</code> is unset, the hostname list is cleared.</p> <h3 id=ifs>IFS<a class=headerlink href=#ifs title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>IFS</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td><code>&lt;space&gt;&lt;tab&gt;&lt;newline&gt;</code></td> </tr> </tbody> </table> <p>The Internal Field Separator |that is used for word splitting after| expansion and to split lines into words with the read builtin command.</p> <h3 id=ignoreeof>IGNOREEOF<a class=headerlink href=#ignoreeof title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>IGNOREEOF</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>10 (when invalid)</td> </tr> </tbody> </table> <p>Controls the action of an interactive shell on receipt of an <code>EOF</code> character (e.g. by Ctrl-D) as the sole input.</p> <p>If set, the value is the number of consecutive EOF characters which must be typed as the first characters on an input line before Bash exits.</p> <p>If the variable exists but does not have a numeric value, or has no value, the default value is 10.</p> <p>If it does not exist, <code>EOF</code> signifies the end of input to the shell.</p> <h3 id=inputrc>INPUTRC<a class=headerlink href=#inputrc title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>INPUTRC</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The filename for the readline startup file, overriding the default of <code>~/.inputrc</code>.</p> <h3 id=lang>LANG<a class=headerlink href=#lang title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>LANG</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>Used to determine the locale category for any category not specifically selected with a variable starting with <code>LC_</code>.</p> <h3 id=lc_all>LC_ALL<a class=headerlink href=#lc_all title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>LC_ALL</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>This variable overrides the value of <code>LANG</code> and any other <code>LC_</code> variable specifying a locale category.</p> <h3 id=lc_collate>LC_COLLATE<a class=headerlink href=#lc_collate title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>LC_COLLATE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>This variable determines the collation order used when sorting the results of pathname expansion, and determines the behavior of range expressions, equivalence classes, and collating sequences within pathname expansion and pattern matching.</p> <h3 id=lc_ctype>LC_CTYPE<a class=headerlink href=#lc_ctype title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>LC_CTYPE</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>This variable determines the interpretation of characters and the behavior of character classes within pathname expansion and pattern matching.</p> <h3 id=lc_messages>LC_MESSAGES<a class=headerlink href=#lc_messages title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>LC_MESSAGES</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>This variable determines the locale used to translate double- quoted strings preceded by a <code>$</code>.</p> <h3 id=lc_numeric>LC_NUMERIC<a class=headerlink href=#lc_numeric title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>LC_NUMERIC</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>This variable determines the locale category used for number formatting.</p> <h3 id=lines>LINES<a class=headerlink href=#lines title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>LINES</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>on <code>|SIGWINCH</code> Default:</td> <td>n/a</td> <td></td> </tr> </tbody> </table> <p>Used by the select compound command to determine the column length for printing selection lists. Automatically set upon receipt of a <code>SIGWINCH</code>.</p> <h3 id=mail>MAIL<a class=headerlink href=#mail title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>MAIL</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>system-dependent</td> </tr> </tbody> </table> <p>If this parameter is set to a file or directory name and the <code>MAILPATH</code> variable is not set, Bash informs the user of the arrival of mail in the specified file or Maildir-format direc tory.</p> <h3 id=mailcheck>MAILCHECK<a class=headerlink href=#mailcheck title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>MAILCHECK</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>60</td> </tr> </tbody> </table> <p>Specifies |how often (in seconds) Bash checks for mail.|</p> <p>When it is time to check for mail, the shell does so before displaying the primary prompt.</p> <p>If this variable is unset, or set to a value that is not a number greater than or equal to zero, the shell disables mail checking.</p> <h3 id=mailpath>MAILPATH<a class=headerlink href=#mailpath title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>MAILPATH</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>system-dependent</td> </tr> </tbody> </table> <p>A colon-separated list of file names to be checked for mail.</p> <p>The message to be printed when mail arrives in a particular file may be specified by separating the file name from the message with a '?' (question mark).</p> <p>When used in the text of the message, <code>$_</code> expands to the name of the current mailfile.</p> <p>Example content:</p> <div class=highlight><pre><span></span><code>/var/mail/bfox?&quot;You have mail&quot;:~/shell-mail?&quot;$_ has mail!&quot;
</code></pre></div> <h3 id=opterr>OPTERR<a class=headerlink href=#opterr title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>OPTERR</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>1 (set on startup)</td> </tr> </tbody> </table> <p>If set to the value 1, Bash displays error messages generated by the <code>getopts</code> builtin command.</p> <p><code>OPTERR</code> is initialized to 1 each time the shell is invoked or a shell script is executed.</p> <h3 id=path>PATH<a class=headerlink href=#path title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PATH</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>system-dependent (set on compile time)</td> </tr> </tbody> </table> <p>The search path for commands. This is a colon-separated list of directories in which the shell looks for commands.</p> <p>A zero-length (null) directory name in the value of <code>PATH</code> indicates the current directory.</p> <p>A null directory name may appear as two adjacent colons, or as an initial or trailing colon.</p> <p>There can be a static path compiled in for use in a restricted shell.</p> <h3 id=posixly_correct>POSIXLY_CORRECT<a class=headerlink href=#posixly_correct title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>POSIXLY_CORRECT</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If this variable is in the environment when Bash starts, the shell enters posix mode before reading the startup files, as if the <code>--posix</code> invocation option had been supplied.</p> <p>If it is set while the shell is running, Bash enables posix mode, as if the command <code>set -o posix</code> had been executed.</p> <h3 id=prompt_command>PROMPT_COMMAND<a class=headerlink href=#prompt_command title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PROMPT_COMMAND</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If set, the value is executed as a command prior to issuing each primary prompt.</p> <h3 id=prompt_commands>PROMPT_COMMANDS<a class=headerlink href=#prompt_commands title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PROMPT_COMMANDS</code></th> <th>Since:</th> <th>5.1-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>integer indexed array</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If set, each element is executed as a command prior to issuing each primary prompt (like <code>PROMPT_COMMAND</code>, just as array).</p> <h3 id=prompt_dirtrim>PROMPT_DIRTRIM<a class=headerlink href=#prompt_dirtrim title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PROMPT_DIRTRIM</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If set to a number greater than zero, the value is used as the number of trailing directory components to retain when expanding the <code>\w</code> and <code>\W</code> prompt string escapes.</p> <p>Characters removed are replaced with an ellipsis.</p> <h3 id=ps0>PS0<a class=headerlink href=#ps0 title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PS0</code></th> <th>Since:</th> <th>4.4.0</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>if unset</td> <td>Default:</td> <td>\"\'\'\'\'\"</td> </tr> </tbody> </table> <p>Expanded |and displayed by interactive shells after reading a complete| command but before executing it.</p> <h3 id=ps1>PS1<a class=headerlink href=#ps1 title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PS1</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>if unset</td> <td>Default:</td> <td>\"\'\'\s-\v\\$ \'\'\"</td> </tr> </tbody> </table> <p>The |value of this parameter is expanded and used as the primary prompt| string. See <a href=https://www.gnu.org/software/bash/manual/bash.html#Controlling-the-Prompt>Controlling the Prompt</a>.</p> <h3 id=ps2>PS2<a class=headerlink href=#ps2 title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PS2</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>if unset</td> <td>Default:</td> <td>\"\'\'&gt; \'\'\"</td> </tr> </tbody> </table> <p>The |value of this parameter is expanded as with PS1 and used as the| secondary prompt string.</p> <h3 id=ps3>PS3<a class=headerlink href=#ps3 title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PS3</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The value of this parameter is used as the prompt for the select command.</p> <h3 id=ps4>PS4<a class=headerlink href=#ps4 title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>PS4</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>if unset</td> <td>Default: \"\'\'+ \'\'\"</td> <td></td> </tr> </tbody> </table> <p>The |value of this parameter is expanded as with <code>PS1</code> and the value is| printed before each command Bash displays during an execution trace. The first character of <code>PS4</code> is replicated multiple times, as necessary, to indicate multiple levels of indirection.</p> <h3 id=shell>SHELL<a class=headerlink href=#shell title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>SHELL</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The full pathname to the shell is kept in this environment variable. If it is not set when the shell starts, Bash assigns the full pathname of the current user's login shell.</p> <h3 id=srandom>SRANDOM<a class=headerlink href=#srandom title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>SRANDOM</code></th> <th>Since:</th> <th>5.1-alpha</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>yes</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>A variable that delivers a 32bit random number. The random number generation uses platform specific generators in the background and a builtin fallback generator.</p> <h3 id=timeformat>TIMEFORMAT<a class=headerlink href=#timeformat title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>TIMEFORMAT</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The value of this parameter is used as a format string specifying how the timing information for pipelines prefixed with the time reserved word should be displayed.</p> <p>The % character introduces an escape sequence that is expanded to a time value or other information. The escape sequences and their meanings are as follows, the braces denote optional portions:</p> <table> <thead> <tr> <th style="text-align: left;"></th> <th style="text-align: left;"></th> </tr> </thead> <tbody> <tr> <td style="text-align: left;"><code>%%</code></td> <td style="text-align: left;">a literal <code>%</code> (percent sign)</td> </tr> <tr> <td style="text-align: left;"><code>%[p][l]R</code></td> <td style="text-align: left;">elapsed time in seconds</td> </tr> <tr> <td style="text-align: left;"><code>%[p][l]U</code></td> <td style="text-align: left;">number of CPU seconds spent in user mode</td> </tr> <tr> <td style="text-align: left;"><code>%[p][l]S</code></td> <td style="text-align: left;">number of CPU seconds spent in system mode</td> </tr> <tr> <td style="text-align: left;"><code>%P</code></td> <td style="text-align: left;">CPU percentage, computed as <code>(%U + %S) / %R</code></td> </tr> </tbody> </table> <p>The optional modifiers (p and l) are:</p> <table> <thead> <tr> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td><code>p</code></td> <td>A digit specifying the precision. A value of 0 causes no decimal point or fraction to be output. At most three digits after the decimal point are shown. If not specified, the value 3 is used.</td> </tr> <tr> <td><code>l</code></td> <td>A longer format, including minutes, of the form MMmSS.FFs. The value of p determines whether or not the fraction is included.</td> </tr> </tbody> </table> <p>If this variable is not set, Bash acts as if it had the value</p> <div class=highlight><pre><span></span><code>$&#39;\nreal\t%3lR\nuser\t%3lU\nsys%3lS&#39;
</code></pre></div> <p>If the value is null, no timing information is displayed.</p> <p>A trailing newline is added when the format string is displayed.</p> <h3 id=tmout>TMOUT<a class=headerlink href=#tmout title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>TMOUT</code></th> <th>Since:</th> <th>2.05b</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If set to a value greater than zero, <code>TMOUT</code> is treated as the default timeout for the <a href=../../commands/builtin/read/ >read builtin command</a>.</p> <p>The <code>select</code> command terminates if input does not arrive after <code>TMOUT</code> seconds when input is coming from a terminal.</p> <p>In an interactive shell, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt. Bash terminates after waiting for that number of seconds if input does not arrive.</p> <h3 id=tmpdir>TMPDIR<a class=headerlink href=#tmpdir title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>TMPDIR</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>If set, Bash uses its value as the name of a directory in which Bash creates temporary files for the shell's use.</p> <h3 id=auto_resume>auto_resume<a class=headerlink href=#auto_resume title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>auto_resume</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>This variable controls how the shell interacts with the user and job control. If this variable is set, single word simple commands without redirections are treated as candidates for resumption of an existing stopped job. There is no ambiguity allowed; if there is more than one job beginning with the string typed, the job most recently accessed is selected. The name of a stopped job, in this context, is the command line used to start it. If set to the value exact, the string supplied must match the name of a stopped job exactly; if set to substring, the string supplied needs to match a substring of the name of a stopped job. The substring value provides functionality analogous to the %? job identifier.</p> <p>If set to any other value, the supplied string must be a prefix of a stopped job's name; this provides functionality analogous to the <code>%string</code> job identifier.</p> <h3 id=histchars>histchars<a class=headerlink href=#histchars title="Permanent link">&para;</a></h3> <table> <thead> <tr> <th>Variable:</th> <th><code>histchars</code></th> <th>Since:</th> <th>unknown</th> </tr> </thead> <tbody> <tr> <td>Type:</td> <td>normal variable</td> <td>Read-only:</td> <td>no</td> </tr> <tr> <td>Set by Bash:</td> <td>no</td> <td>Default:</td> <td>n/a</td> </tr> </tbody> </table> <p>The two or three characters which control history expansion and tokenization.</p> <p>The first character is the history expansion character, the character which signals the start of a history expansion, normally '!' (exlamation mark).</p> <p>The second character is the quick substitution character, which is used as shorthand for re-running the previous command entered, substi tuting one string for another in the command. The default is '^' (carret).</p> <p>The optional third character is the character which indicates that the remainder of the line is a comment when found as the first character of a word, normally '#' (hash mark). The history comment character causes history substitution to be skipped for the remaining words on the line. It does not necessarily cause the shell parser to treat the rest of the line as a comment.</p> <aside class=md-source-file> <span class=md-source-file__fact> <span class=md-icon title="Last update"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1zM12.5 7v5.2l4 2.4-1 1L11 13V7zM11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2z"/></svg> </span> <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">November 13, 2024</span> </span> <span class=md-source-file__fact> <span class=md-icon title=Created> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M14.47 15.08 11 13V7h1.5v5.25l3.08 1.83c-.41.28-.79.62-1.11 1m-1.39 4.84c-.36.05-.71.08-1.08.08-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8c0 .37-.03.72-.08 1.08.69.1 1.33.32 1.92.64.1-.56.16-1.13.16-1.72 0-5.5-4.5-10-10-10S2 6.5 2 12s4.47 10 10 10c.59 0 1.16-.06 1.72-.16-.32-.59-.54-1.23-.64-1.92M18 15v3h-3v2h3v3h2v-3h3v-2h-3v-3z"/></svg> </span> <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">November 13, 2024</span> </span> </aside> <h2 id=__comments>Comments</h2> <script src=https://giscus.app/client.js data-repo=flokoe/bash-hackers-wiki data-repo-id=R_kgDOJ3Nr6Q data-category="Giscus Page Comments" data-category-id=DIC_kwDOJ3Nr6c4CXq9t data-mapping=pathname data-strict=1 data-reactions-enabled=1 data-emit-metadata=0 data-input-position=top data-theme=preferred_color_scheme data-lang=en data-loading=lazy crossorigin=anonymous async>
</script> <script>
var giscus = document.querySelector("script[src*=giscus]")
/* Set palette on initial load */
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"
giscus.setAttribute("data-theme", theme)
}
/* Register event handlers after documented loaded */
document.addEventListener("DOMContentLoaded", function() {
var ref = document.querySelector("[data-md-component=palette]")
ref.addEventListener("change", function() {
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"
/* Instruct Giscus to change theme */
var frame = document.querySelector(".giscus-frame")
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme } } },
"https://giscus.app"
)
}
})
})
</script> </article> </div> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> <button type=button class="md-top md-icon" data-md-component=top hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg> Back to top </button> </main> <footer class=md-footer> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class=md-copyright> Made with <a href=https://squidfunk.github.io/mkdocs-material/ target=_blank rel=noopener> Material for MkDocs </a> </div> </div> </div> </footer> </div> <div class=md-dialog data-md-component=dialog> <div class="md-dialog__inner md-typeset"></div> </div> <script id=__config type=application/json>{"base": "../..", "features": ["navigation.instant", "navigation.tracking", "navigation.tabs", "navigation.sections", "navigation.top", "content.action.view", "content.action.edit", "search.suggest", "search.highlight", "content.code.copy"], "search": "../../assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script> <script src=../../assets/javascripts/bundle.83f73b43.min.js></script> </body> </html>