CINXE.COM
Shell script - Wikipedia
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-sticky-header-enabled vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Shell script - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-sticky-header-enabled vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy", "wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"233c9a30-8c3b-4505-9ce6-a96e8fc1bf47","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Shell_script","wgTitle":"Shell script","wgCurRevisionId":1259032770,"wgRevisionId":1259032770,"wgArticleId":28938,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Wikipedia articles needing factual verification from May 2017","Articles with short description","Short description matches Wikidata","Articles needing additional references from February 2014","All articles needing additional references","Scripting languages"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Shell_script","wgRelevantArticleId":28938,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true, "wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":20000,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q959549","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":false, "wgGELevelingUpEnabledForUser":false};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","ext.pygments":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","jquery.makeCollapsible.styles":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["ext.cite.ux-enhancements","ext.pygments.view","mediawiki.page.media","site","mediawiki.page.ready","jquery.makeCollapsible","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init", "ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.growthExperiments.SuggestedEditSession"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&modules=ext.cite.styles%7Cext.pygments%2CwikimediaBadges%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cjquery.makeCollapsible.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.15"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/f/f0/FreeBSD_10_vi_RC_Firewall.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="707"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/f/f0/FreeBSD_10_vi_RC_Firewall.png"> <meta property="og:image:width" content="800"> <meta property="og:image:height" content="471"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f0/FreeBSD_10_vi_RC_Firewall.png/640px-FreeBSD_10_vi_RC_Firewall.png"> <meta property="og:image:width" content="640"> <meta property="og:image:height" content="377"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Shell script - Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/Shell_script"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=Shell_script&action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/Shell_script"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Shell_script rootpage-Shell_script skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" title="Main menu" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page's font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&returnto=Shell+script" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&returnto=Shell+script" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&returnto=Shell+script" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&returnto=Shell+script" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-Capabilities" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Capabilities"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Capabilities</span> </div> </a> <button aria-controls="toc-Capabilities-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Capabilities subsection</span> </button> <ul id="toc-Capabilities-sublist" class="vector-toc-list"> <li id="toc-Comments" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Comments"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>Comments</span> </div> </a> <ul id="toc-Comments-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Configurable_choice_of_scripting_language" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Configurable_choice_of_scripting_language"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2</span> <span>Configurable choice of scripting language</span> </div> </a> <ul id="toc-Configurable_choice_of_scripting_language-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Shortcuts" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Shortcuts"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.3</span> <span>Shortcuts</span> </div> </a> <ul id="toc-Shortcuts-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Batch_jobs" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Batch_jobs"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.4</span> <span>Batch jobs</span> </div> </a> <ul id="toc-Batch_jobs-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Generalization" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Generalization"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.5</span> <span>Generalization</span> </div> </a> <ul id="toc-Generalization-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Programming" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Programming"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.6</span> <span>Programming</span> </div> </a> <ul id="toc-Programming-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Typical_POSIX_scripting_languages" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Typical_POSIX_scripting_languages"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Typical POSIX scripting languages</span> </div> </a> <ul id="toc-Typical_POSIX_scripting_languages-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Other_scripting_languages" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Other_scripting_languages"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Other scripting languages</span> </div> </a> <ul id="toc-Other_scripting_languages-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Life_cycle" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Life_cycle"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Life cycle</span> </div> </a> <ul id="toc-Life_cycle-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Advantages_and_disadvantages" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Advantages_and_disadvantages"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Advantages and disadvantages</span> </div> </a> <ul id="toc-Advantages_and_disadvantages-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Interoperability_among_scripting_languages" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Interoperability_among_scripting_languages"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>Interoperability among scripting languages</span> </div> </a> <ul id="toc-Interoperability_among_scripting_languages-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Shell_scripting_on_other_operating_systems" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Shell_scripting_on_other_operating_systems"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>Shell scripting on other operating systems</span> </div> </a> <ul id="toc-Shell_scripting_on_other_operating_systems-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">9</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-External_links" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#External_links"> <div class="vector-toc-text"> <span class="vector-toc-numb">10</span> <span>External links</span> </div> </a> <ul id="toc-External_links-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" title="Table of Contents" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Shell script</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 20 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-20" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">20 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D8%A5%D8%AE%D8%B7%D8%A7%D8%B7_%D9%88%D8%A7%D8%AC%D9%87%D8%A9_%D8%A7%D9%84%D8%A3%D9%88%D8%A7%D9%85%D8%B1" title="إخطاط واجهة الأوامر – Arabic" lang="ar" hreflang="ar" data-title="إخطاط واجهة الأوامر" data-language-autonym="العربية" data-language-local-name="Arabic" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-bn mw-list-item"><a href="https://bn.wikipedia.org/wiki/%E0%A6%B6%E0%A7%87%E0%A6%B2_%E0%A6%B8%E0%A7%8D%E0%A6%95%E0%A7%8D%E0%A6%B0%E0%A6%BF%E0%A6%AA%E0%A7%8D%E0%A6%9F" title="শেল স্ক্রিপ্ট – Bangla" lang="bn" hreflang="bn" data-title="শেল স্ক্রিপ্ট" data-language-autonym="বাংলা" data-language-local-name="Bangla" class="interlanguage-link-target"><span>বাংলা</span></a></li><li class="interlanguage-link interwiki-ca mw-list-item"><a href="https://ca.wikipedia.org/wiki/Shell_script" title="Shell script – Catalan" lang="ca" hreflang="ca" data-title="Shell script" data-language-autonym="Català" data-language-local-name="Catalan" class="interlanguage-link-target"><span>Català</span></a></li><li class="interlanguage-link interwiki-cs mw-list-item"><a href="https://cs.wikipedia.org/wiki/Shellov%C3%BD_skript" title="Shellový skript – Czech" lang="cs" hreflang="cs" data-title="Shellový skript" data-language-autonym="Čeština" data-language-local-name="Czech" class="interlanguage-link-target"><span>Čeština</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Shellskript" title="Shellskript – German" lang="de" hreflang="de" data-title="Shellskript" data-language-autonym="Deutsch" data-language-local-name="German" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Script_de_shell" title="Script de shell – Spanish" lang="es" hreflang="es" data-title="Script de shell" data-language-autonym="Español" data-language-local-name="Spanish" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%B4%D9%84_%D8%A7%D8%B3%DA%A9%D8%B1%DB%8C%D9%BE%D8%AA" title="شل اسکریپت – Persian" lang="fa" hreflang="fa" data-title="شل اسکریپت" data-language-autonym="فارسی" data-language-local-name="Persian" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fr mw-list-item"><a href="https://fr.wikipedia.org/wiki/Script_shell" title="Script shell – French" lang="fr" hreflang="fr" data-title="Script shell" data-language-autonym="Français" data-language-local-name="French" class="interlanguage-link-target"><span>Français</span></a></li><li class="interlanguage-link interwiki-gl mw-list-item"><a href="https://gl.wikipedia.org/wiki/Shell_script" title="Shell script – Galician" lang="gl" hreflang="gl" data-title="Shell script" data-language-autonym="Galego" data-language-local-name="Galician" class="interlanguage-link-target"><span>Galego</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EC%85%B8_%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8" title="셸 스크립트 – Korean" lang="ko" hreflang="ko" data-title="셸 스크립트" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-is mw-list-item"><a href="https://is.wikipedia.org/wiki/Skeljaforrit" title="Skeljaforrit – Icelandic" lang="is" hreflang="is" data-title="Skeljaforrit" data-language-autonym="Íslenska" data-language-local-name="Icelandic" class="interlanguage-link-target"><span>Íslenska</span></a></li><li class="interlanguage-link interwiki-nl mw-list-item"><a href="https://nl.wikipedia.org/wiki/Shellscript" title="Shellscript – Dutch" lang="nl" hreflang="nl" data-title="Shellscript" data-language-autonym="Nederlands" data-language-local-name="Dutch" class="interlanguage-link-target"><span>Nederlands</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/%E3%82%B7%E3%82%A7%E3%83%AB%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88" title="シェルスクリプト – Japanese" lang="ja" hreflang="ja" data-title="シェルスクリプト" data-language-autonym="日本語" data-language-local-name="Japanese" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-no mw-list-item"><a href="https://no.wikipedia.org/wiki/Skallskript" title="Skallskript – Norwegian Bokmål" lang="nb" hreflang="nb" data-title="Skallskript" data-language-autonym="Norsk bokmål" data-language-local-name="Norwegian Bokmål" class="interlanguage-link-target"><span>Norsk bokmål</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Shell_script" title="Shell script – Portuguese" lang="pt" hreflang="pt" data-title="Shell script" data-language-autonym="Português" data-language-local-name="Portuguese" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%A1%D1%86%D0%B5%D0%BD%D0%B0%D1%80%D0%B8%D0%B9_%D0%BA%D0%BE%D0%BC%D0%B0%D0%BD%D0%B4%D0%BD%D0%BE%D0%B9_%D1%81%D1%82%D1%80%D0%BE%D0%BA%D0%B8" title="Сценарий командной строки – Russian" lang="ru" hreflang="ru" data-title="Сценарий командной строки" data-language-autonym="Русский" data-language-local-name="Russian" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-fi mw-list-item"><a href="https://fi.wikipedia.org/wiki/Shell-skripti" title="Shell-skripti – Finnish" lang="fi" hreflang="fi" data-title="Shell-skripti" data-language-autonym="Suomi" data-language-local-name="Finnish" class="interlanguage-link-target"><span>Suomi</span></a></li><li class="interlanguage-link interwiki-tr mw-list-item"><a href="https://tr.wikipedia.org/wiki/Kabuk_programlama" title="Kabuk programlama – Turkish" lang="tr" hreflang="tr" data-title="Kabuk programlama" data-language-autonym="Türkçe" data-language-local-name="Turkish" class="interlanguage-link-target"><span>Türkçe</span></a></li><li class="interlanguage-link interwiki-vi mw-list-item"><a href="https://vi.wikipedia.org/wiki/C%C3%A2u_l%E1%BB%87nh_shell" title="Câu lệnh shell – Vietnamese" lang="vi" hreflang="vi" data-title="Câu lệnh shell" data-language-autonym="Tiếng Việt" data-language-local-name="Vietnamese" class="interlanguage-link-target"><span>Tiếng Việt</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E5%A4%96%E5%A3%B3%E8%84%9A%E6%9C%AC" title="外壳脚本 – Chinese" lang="zh" hreflang="zh" data-title="外壳脚本" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q959549#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Shell_script" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Shell_script" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Shell_script"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Shell_script&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Shell_script&action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Shell_script"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Shell_script&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Shell_script&action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Shell_script" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Shell_script" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Shell_script&oldid=1259032770" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Shell_script&action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&page=Shell_script&id=1259032770&wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FShell_script"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FShell_script"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&page=Shell_script&action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Shell_script&printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q959549" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">Script written for the shell, or command line interpreter, of an operating system</div> <style data-mw-deduplicate="TemplateStyles:r1236090951">.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}</style><div role="note" class="hatnote navigation-not-searchable">This article is about scripting in Unix-like systems. For batch programming in DOS, OS/2 and Windows, see <a href="/wiki/Batch_file" title="Batch file">Batch file</a>. For batch programming in Windows PowerShell shell, see <a href="/wiki/Windows_PowerShell#Scripting" class="mw-redirect" title="Windows PowerShell">Windows PowerShell § Scripting</a>. For programming in the shells (cmd.exe) in operating systems of the Windows NT/2000 series, see <a href="/wiki/Cmd.exe" title="Cmd.exe">cmd.exe</a>. For shell programming, by means of files called Command Scripts or Procedures on Vax/VMS machines, see <a href="/wiki/DIGITAL_Command_Language" title="DIGITAL Command Language">DIGITAL Command Language</a>.</div> <style data-mw-deduplicate="TemplateStyles:r1251242444">.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}</style><table class="box-More_citations_needed plainlinks metadata ambox ambox-content ambox-Refimprove" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><a href="/wiki/File:Question_book-new.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/50px-Question_book-new.svg.png" decoding="async" width="50" height="39" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/75px-Question_book-new.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/100px-Question_book-new.svg.png 2x" data-file-width="512" data-file-height="399" /></a></span></div></td><td class="mbox-text"><div class="mbox-text-span">This article <b>needs additional citations for <a href="/wiki/Wikipedia:Verifiability" title="Wikipedia:Verifiability">verification</a></b>.<span class="hide-when-compact"> Please help <a href="/wiki/Special:EditPage/Shell_script" title="Special:EditPage/Shell script">improve this article</a> by <a href="/wiki/Help:Referencing_for_beginners" title="Help:Referencing for beginners">adding citations to reliable sources</a>. Unsourced material may be challenged and removed.<br /><small><span class="plainlinks"><i>Find sources:</i> <a rel="nofollow" class="external text" href="https://www.google.com/search?as_eq=wikipedia&q=%22Shell+script%22">"Shell script"</a> – <a rel="nofollow" class="external text" href="https://www.google.com/search?tbm=nws&q=%22Shell+script%22+-wikipedia&tbs=ar:1">news</a> <b>·</b> <a rel="nofollow" class="external text" href="https://www.google.com/search?&q=%22Shell+script%22&tbs=bkt:s&tbm=bks">newspapers</a> <b>·</b> <a rel="nofollow" class="external text" href="https://www.google.com/search?tbs=bks:1&q=%22Shell+script%22+-wikipedia">books</a> <b>·</b> <a rel="nofollow" class="external text" href="https://scholar.google.com/scholar?q=%22Shell+script%22">scholar</a> <b>·</b> <a rel="nofollow" class="external text" href="https://www.jstor.org/action/doBasicSearch?Query=%22Shell+script%22&acc=on&wc=on">JSTOR</a></span></small></span> <span class="date-container"><i>(<span class="date">February 2014</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <figure class="mw-default-size" typeof="mw:File/Thumb"><a href="/wiki/File:FreeBSD_10_vi_RC_Firewall.png" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/f/f0/FreeBSD_10_vi_RC_Firewall.png/220px-FreeBSD_10_vi_RC_Firewall.png" decoding="async" width="220" height="130" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/f/f0/FreeBSD_10_vi_RC_Firewall.png/330px-FreeBSD_10_vi_RC_Firewall.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/f/f0/FreeBSD_10_vi_RC_Firewall.png/440px-FreeBSD_10_vi_RC_Firewall.png 2x" data-file-width="730" data-file-height="430" /></a><figcaption>Editing a <a href="/wiki/FreeBSD" title="FreeBSD">FreeBSD</a> shell script for configuring <a href="/wiki/Ipfirewall" title="Ipfirewall">ipfirewall</a> </figcaption></figure> <p>A <b>shell script</b> is a <a href="/wiki/Computer_program" title="Computer program">computer program</a> designed to be run by a <a href="/wiki/Unix_shell" title="Unix shell">Unix shell</a>, a <a href="/wiki/Command-line_interpreter" class="mw-redirect" title="Command-line interpreter">command-line interpreter</a>.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> The various dialects of shell scripts are considered to be <a href="/wiki/Command_language" title="Command language">command languages</a>. Typical operations performed by shell scripts include file manipulation, program execution, and printing text. A script which sets up the environment, runs the program, and does any necessary cleanup or logging, is called a <b>wrapper</b>. </p><p>The term is also used more generally to mean the automated mode of running an operating system shell; each operating system uses a particular name for these functions including batch files (MSDos-Win95 stream, <a href="/wiki/OS/2" title="OS/2">OS/2</a>), command procedures (VMS), and shell scripts (<a href="/wiki/Windows_NT" title="Windows NT">Windows NT</a> stream and third-party derivatives like <a href="/wiki/4NT_(shell)" class="mw-redirect" title="4NT (shell)">4NT</a>—article is at <a href="/wiki/Cmd.exe" title="Cmd.exe">cmd.exe</a>), and mainframe operating systems are associated with a number of terms. </p><p>Shells commonly present in Unix and Unix-like systems include the <a href="/wiki/Korn_shell" class="mw-redirect" title="Korn shell">Korn shell</a>, the <a href="/wiki/Bourne_shell" title="Bourne shell">Bourne shell</a>, and <a href="/wiki/GNU_Bash" class="mw-redirect" title="GNU Bash">GNU Bash</a>. While a Unix operating system may have a different default shell, such as <a href="/wiki/Zsh" class="mw-redirect" title="Zsh">Zsh</a> on <a href="/wiki/MacOS" title="MacOS">macOS</a>, these shells are typically present for backwards compatibility. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Capabilities">Capabilities</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=1" title="Edit section: Capabilities"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading3"><h3 id="Comments">Comments</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=2" title="Edit section: Comments"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><a href="/wiki/Comment_(computer_programming)" title="Comment (computer programming)">Comments</a> are ignored by the shell. They typically begin with the hash symbol (<code>#</code>), and continue until the end of the line.<sup id="cite_ref-Pro_Bash_Programming_2-0" class="reference"><a href="#cite_note-Pro_Bash_Programming-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Configurable_choice_of_scripting_language">Configurable choice of scripting language</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=3" title="Edit section: Configurable choice of scripting language"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <a href="/wiki/Shebang_(Unix)" title="Shebang (Unix)">shebang</a>, or hash-bang, is a special kind of comment which the system uses to determine what interpreter to use to execute the file. The shebang must be the first line of the file, and start with "<code>#!</code>".<sup id="cite_ref-Pro_Bash_Programming_2-1" class="reference"><a href="#cite_note-Pro_Bash_Programming-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> In Unix-like operating systems, the characters following the "<code>#!</code>" prefix are interpreted as a path to an executable program that will interpret the script.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Shortcuts">Shortcuts</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=4" title="Edit section: Shortcuts"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A shell script can provide a convenient variation of a system command where special environment settings, command options, or post-processing apply automatically, but in a way that allows the new script to still act as a fully normal <a href="/wiki/Unix_command" class="mw-redirect" title="Unix command">Unix command</a>. </p><p>One example would be to create a version of <a href="/wiki/Ls" title="Ls">ls</a>, the command to list files, giving it a shorter command name of <code>l</code>, which would be normally saved in a user's <code>bin</code> directory as <code>/home/<i>username</i>/bin/l</code>, and a default set of command options pre-supplied. </p> <div class="mw-highlight mw-highlight-lang-sh mw-content-ltr" dir="ltr"><pre><span></span><span class="ch">#!/bin/sh</span> <span class="nv">LC_COLLATE</span><span class="o">=</span>C<span class="w"> </span>ls<span class="w"> </span>-FCas<span class="w"> </span><span class="s2">"</span><span class="nv">$@</span><span class="s2">"</span> </pre></div> <p>Here, the first line uses a <a href="#Configurable_choice_of_scripting_language">shebang</a> to indicate which interpreter should execute the rest of the script, and the second line makes a listing with options for file format indicators, columns, all files (none omitted), and a size in blocks. The <code>LC_COLLATE=C</code> sets the default collation order to not fold upper and lower case together, not intermix <a href="/wiki/Dotfile" class="mw-redirect" title="Dotfile">dotfiles</a> with normal filenames as a side effect of ignoring punctuation in the names (dotfiles are usually only shown if an option like <code>-a</code> is used), and the <code>"$@"</code> causes any parameters given to <code>l</code> to pass through as parameters to ls, so that all of the normal options and other <a href="/wiki/Programming_language_syntax" class="mw-redirect" title="Programming language syntax">syntax</a> known to ls can still be used. </p><p>The user could then simply use <code>l</code> for the most commonly used short listing. </p><p>Another example of a shell script that could be used as a shortcut would be to print a list of all the files and directories within a given directory. </p> <div class="mw-highlight mw-highlight-lang-sh mw-content-ltr" dir="ltr"><pre><span></span><span class="ch">#!/bin/sh</span> clear ls<span class="w"> </span>-al </pre></div> <p>In this case, the shell script would start with its normal starting line of <span style="font-family:courier">#!/bin/sh</span>. Following this, the script executes the command <span style="font-family:courier">clear</span> which clears the terminal of all text before going to the next line. The following line provides the main function of the script. The <span style="font-family:courier">ls -al</span> command lists the files and directories that are in the directory from which the script is being run. The <span style="font-family:courier"><a href="/wiki/Ls" title="Ls">ls</a></span> command attributes could be changed to reflect the needs of the user. </p> <div class="mw-heading mw-heading3"><h3 id="Batch_jobs">Batch jobs</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=5" title="Edit section: Batch jobs"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Shell scripts allow several commands that would be entered manually at a command-line interface to be executed automatically, and without having to wait for a user to trigger each stage of the sequence. For example, in a directory with three C source code files, rather than manually running the four commands required to build the final program from them, one could instead create a script for <a href="/wiki/POSIX" title="POSIX">POSIX</a>-compliant shells, here named <code>build</code> and kept in the directory with them, which would compile them automatically: </p> <div class="mw-highlight mw-highlight-lang-sh mw-content-ltr" dir="ltr"><pre><span></span><span class="ch">#!/bin/sh</span> <span class="nb">printf</span><span class="w"> </span><span class="s1">'compiling...\n'</span> cc<span class="w"> </span>-c<span class="w"> </span>foo.c cc<span class="w"> </span>-c<span class="w"> </span>bar.c cc<span class="w"> </span>-c<span class="w"> </span>qux.c cc<span class="w"> </span>-o<span class="w"> </span>myprog<span class="w"> </span>foo.o<span class="w"> </span>bar.o<span class="w"> </span>qux.o <span class="nb">printf</span><span class="w"> </span><span class="s1">'done.\n'</span> </pre></div> <p>The script would allow a user to save the file being edited, pause the editor, and then just run <code>./build</code> to create the updated program, test it, and then return to the editor. Since the 1980s or so, however, scripts of this type have been replaced with utilities like <a href="/wiki/Make_(software)" title="Make (software)">make</a> which are specialized for building programs. </p> <div class="mw-heading mw-heading3"><h3 id="Generalization">Generalization</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=6" title="Edit section: Generalization"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Simple batch jobs are not unusual for isolated tasks, but using shell loops, tests, and variables provides much more flexibility to users. A POSIX sh script to convert JPEG images to PNG images, where the image names are provided on the command-line—possibly via wildcards—instead of each being listed within the script, can be created with this file, typically saved in a file like <code>/home/<i>username</i>/bin/jpg2png</code> </p> <div class="mw-highlight mw-highlight-lang-sh mw-content-ltr" dir="ltr"><pre><span></span><span class="ch">#!/bin/sh</span> <span class="k">for</span><span class="w"> </span>jpg<span class="p">;</span><span class="w"> </span><span class="k">do</span><span class="w"> </span><span class="c1"># use $jpg in place of each filename given, in turn</span> <span class="w"> </span><span class="nv">png</span><span class="o">=</span><span class="si">${</span><span class="nv">jpg</span><span class="p">%.jpg</span><span class="si">}</span>.png<span class="w"> </span><span class="c1"># construct the PNG version of the filename by replacing .jpg with .png</span> <span class="w"> </span><span class="nb">printf</span><span class="w"> </span><span class="s1">'converting "%s" ...\n'</span><span class="w"> </span><span class="s2">"</span><span class="nv">$jpg</span><span class="s2">"</span><span class="w"> </span><span class="c1"># output status info to the user running the script</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span>convert<span class="w"> </span><span class="s2">"</span><span class="nv">$jpg</span><span class="s2">"</span><span class="w"> </span>jpg.to.png<span class="p">;</span><span class="w"> </span><span class="k">then</span><span class="w"> </span><span class="c1"># use convert (provided by ImageMagick) to create the PNG in a temp file</span> <span class="w"> </span>mv<span class="w"> </span>jpg.to.png<span class="w"> </span><span class="s2">"</span><span class="nv">$png</span><span class="s2">"</span><span class="w"> </span><span class="c1"># if it worked, rename the temporary PNG image to the correct name</span> <span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="c1"># ...otherwise complain and exit from the script</span> <span class="w"> </span><span class="nb">printf</span><span class="w"> </span>><span class="p">&</span><span class="m">2</span><span class="w"> </span><span class="s1">'jpg2png: error: failed output saved in "jpg.to.png".\n'</span> <span class="w"> </span><span class="nb">exit</span><span class="w"> </span><span class="m">1</span> <span class="w"> </span><span class="k">fi</span><span class="w"> </span><span class="c1"># the end of the "if" test construct</span> <span class="k">done</span><span class="w"> </span><span class="c1"># the end of the "for" loop</span> <span class="nb">printf</span><span class="w"> </span><span class="s1">'all conversions successful\n'</span><span class="w"> </span><span class="c1"># tell the user the good news</span> </pre></div> <p>The <code>jpg2png</code> command can then be run on an entire directory full of JPEG images with just <code>/home/<i>username</i>/bin/jpg2png *.jpg</code> </p> <div class="mw-heading mw-heading3"><h3 id="Programming">Programming</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=7" title="Edit section: Programming"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Many modern shells also supply various features usually found only in more sophisticated <a href="/wiki/General-purpose_programming_language" title="General-purpose programming language">general-purpose programming languages</a>, such as control-flow constructs, variables, <a href="/wiki/Comment_(computer_programming)" title="Comment (computer programming)">comments</a>, arrays, <a href="/wiki/Subroutine" class="mw-redirect" title="Subroutine">subroutines</a> and so on. With these sorts of features available, it is possible to write reasonably sophisticated applications as shell scripts. However, they are still limited by the fact that most shell languages have little or no support for data typing systems, classes, threading, complex math, and other common full language features, and are also generally much slower than compiled code or interpreted languages written with speed as a performance goal. </p><p>The standard Unix tools <a href="/wiki/Sed" title="Sed">sed</a> and <a href="/wiki/Awk" class="mw-redirect" title="Awk">awk</a> provide extra capabilities for shell programming; <a href="/wiki/Perl" title="Perl">Perl</a> can also be embedded in shell scripts as can other scripting languages like <a href="/wiki/Tcl" title="Tcl">Tcl</a>. Perl and Tcl come with graphics toolkits as well. </p> <div class="mw-heading mw-heading2"><h2 id="Typical_POSIX_scripting_languages">Typical POSIX scripting languages</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=8" title="Edit section: Typical POSIX scripting languages"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Unix_shell" title="Unix shell">Unix shell</a></div> <p>Scripting languages commonly found on UNIX, Linux, and POSIX-compliant operating system installations include: </p> <ul><li><a href="/wiki/KornShell" title="KornShell">KornShell</a> (<code>ksh</code>) in several possible versions such as ksh88, Korn Shell '93 and others.</li> <li>The <a href="/wiki/Bourne_shell" title="Bourne shell">Bourne shell</a> (<code>sh</code>), one of the oldest shells still common in use</li> <li>The <a href="/wiki/C_shell" title="C shell">C shell</a> (<code>csh</code>)</li> <li><a href="/wiki/Bash_(Unix_shell)" title="Bash (Unix shell)">GNU Bash</a> (<code>bash</code>)</li> <li><code><a href="/wiki/Tclsh" class="mw-redirect" title="Tclsh">tclsh</a></code>, a shell which is a main component of the <a href="/wiki/Tcl/Tk" class="mw-redirect" title="Tcl/Tk">Tcl/Tk</a> programming language.</li> <li>The <a href="/wiki/Wish_(shell)" class="mw-redirect" title="Wish (shell)">wish</a> is a GUI-based Tcl/Tk shell.</li></ul> <p>The C and Tcl shells have syntax quite similar to that of said programming languages, and the Korn shells and Bash are developments of the Bourne shell, which is based on the <a href="/wiki/ALGOL" title="ALGOL">ALGOL</a> language with elements of a number of others added as well.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> On the other hand, the various shells plus tools like <a href="/wiki/Awk" class="mw-redirect" title="Awk">awk</a>, <a href="/wiki/Sed" title="Sed">sed</a>, <a href="/wiki/Grep" title="Grep">grep</a>, and <a href="/wiki/BASIC" title="BASIC">BASIC</a>, <a href="/wiki/Lisp_(programming_language)" title="Lisp (programming language)">Lisp</a>, <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a> and so forth contributed to the <a href="/wiki/Perl" title="Perl">Perl</a> programming language.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> </p><p>Other shells that may be available on a machine or for download and/or purchase include: </p> <ul><li><a href="/wiki/Almquist_shell" title="Almquist shell">Almquist shell</a> (<code>ash</code>)</li> <li><a href="/wiki/Nushell" title="Nushell">Nushell</a> (<code>nu</code>)</li> <li><a href="/wiki/PowerShell" title="PowerShell">PowerShell</a> (<code>msh</code>)</li> <li><a href="/wiki/Z_shell" title="Z shell">Z shell</a> (<code>zsh</code>, a particularly common enhanced KornShell)</li> <li>The <a href="/wiki/Tenex_C_Shell" class="mw-redirect" title="Tenex C Shell">Tenex C Shell</a> (<code>tcsh</code>).</li></ul> <p>Related programs such as shells based on <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a>, <a href="/wiki/Ruby_(programming_language)" title="Ruby (programming language)">Ruby</a>, <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a>, <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a>, <a href="/wiki/Perl" title="Perl">Perl</a>, <a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a>, <a href="/wiki/Rexx" title="Rexx">Rexx</a> etc. in various forms are also widely available. Another somewhat common shell is <a href="/w/index.php?title=Old_shell&action=edit&redlink=1" class="new" title="Old shell (page does not exist)">Old shell</a> (<code>osh</code>), whose manual page states it "is an enhanced, backward-compatible port of the standard command interpreter from Sixth Edition UNIX."<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> </p><p>So called remote shells such as </p> <ul><li>a <a href="/wiki/Remote_Shell" title="Remote Shell">Remote Shell</a> (<code>rsh</code>)</li> <li>a <a href="/wiki/Secure_Shell" title="Secure Shell">Secure Shell</a> (<code>ssh</code>)</li></ul> <p>are really just tools to run a more complex shell on a remote system and have no 'shell' like characteristics themselves. </p> <div class="mw-heading mw-heading2"><h2 id="Other_scripting_languages">Other scripting languages</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=9" title="Edit section: Other scripting languages"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Scripting_language" title="Scripting language">Scripting language</a></div> <p>Many powerful scripting languages have been introduced for tasks that are too large or complex to be comfortably handled with ordinary shell scripts, but for which the advantages of a script are desirable and the development overhead of a full-blown, compiled programming language would be disadvantageous. The specifics of what separates scripting languages from <a href="/wiki/High-level_programming_language" title="High-level programming language">high-level programming languages</a> is a frequent source of debate, but, generally speaking, a scripting language is one which requires an interpreter. </p> <div class="mw-heading mw-heading2"><h2 id="Life_cycle">Life cycle</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=10" title="Edit section: Life cycle"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Shell scripts often serve as an initial stage in software development, and are often subject to conversion later to a different underlying implementation, most commonly being converted to <a href="/wiki/Perl" title="Perl">Perl</a>, <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a>, or <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a>. The <a href="/wiki/Interpreter_directive" title="Interpreter directive">interpreter directive</a> allows the implementation detail to be fully hidden inside the script, rather than being exposed as a filename extension, and provides for seamless reimplementation in different languages with no impact on end users. </p><p>While files with the ".sh" <a href="/wiki/File_extension" class="mw-redirect" title="File extension">file extension</a> are usually a shell script of some kind, most shell scripts do not have any filename extension.<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="Advantages_and_disadvantages">Advantages and disadvantages</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=11" title="Edit section: Advantages and disadvantages"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Perhaps the biggest advantage of writing a shell script is that the commands and syntax are exactly the same as those directly entered at the command-line. The programmer does not have to switch to a totally different syntax, as they would if the script were written in a different language, or if a compiled language were used. </p><p>Often, writing a shell script is much quicker than writing the equivalent code in other programming languages. The many advantages include easy program or file selection, quick start, and interactive debugging. A shell script can be used to provide a sequencing and decision-making linkage around existing programs, and for moderately sized scripts the absence of a compilation step is an advantage. Interpretive running makes it easy to write debugging code into a script and re-run it to detect and fix bugs. Non-expert users can use scripting to tailor the behavior of programs, and shell scripting provides some limited scope for multiprocessing. </p><p>On the other hand, shell scripting is prone to costly errors. Inadvertent typing errors such as <code><a href="/wiki/Rm_(Unix)" title="Rm (Unix)">rm</a> -rf * /</code> (instead of the intended <code>rm -rf */</code>) are folklore in the Unix community; a single extra space converts the command from one that deletes all subdirectories contained in the current directory, to one which deletes everything from the file system's <a href="/wiki/Root_directory" title="Root directory">root directory</a>. Similar problems can transform <code><a href="/wiki/Cp_(Unix)" title="Cp (Unix)">cp</a></code> and <code><a href="/wiki/Mv_(Unix)" title="Mv (Unix)">mv</a></code> into dangerous weapons, and misuse of the <code>></code> redirect can delete the contents of a file. This is made more problematic by the fact that many UNIX commands differ in name by only one letter: <code>cp</code>, <code><a href="/wiki/Cd_(command)" title="Cd (command)">cd</a></code>, <code><a href="/wiki/Dd_(Unix)" title="Dd (Unix)">dd</a></code>, <code><a href="/wiki/Df_(Unix)" title="Df (Unix)">df</a></code>, etc. </p><p>Another significant disadvantage is the slow execution speed and the need to launch a new process for almost every shell command executed. When a script's job can be accomplished by setting up a <a href="/wiki/Pipeline_(computing)" title="Pipeline (computing)">pipeline</a> in which efficient <a href="/wiki/Filter_(software)" title="Filter (software)">filter</a> commands perform most of the work, the slowdown is mitigated, but a complex script is typically several orders of magnitude slower than a conventional compiled program that performs an equivalent task. </p><p>There are also compatibility problems between different platforms. <a href="/wiki/Larry_Wall" title="Larry Wall">Larry Wall</a>, creator of <a href="/wiki/Perl" title="Perl">Perl</a>, famously wrote that "It's easier to port a shell than a shell script."<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup> </p><p>Similarly, more complex scripts can run into the limitations of the shell scripting language itself; the limits make it difficult to write quality code, and extensions by various shells to ameliorate problems with the original shell language can make problems worse.<sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup> </p><p>Many disadvantages of using some script languages are caused by design flaws within the <a href="/wiki/Programming_language_syntax" class="mw-redirect" title="Programming language syntax">language syntax</a> or implementation, and are not necessarily imposed by the use of a text-based command-line; there are a number of shells which use other shell programming languages or even full-fledged languages like <a href="/wiki/Scsh" title="Scsh">Scsh</a> (which uses <a href="/wiki/Scheme_(programming_language)" title="Scheme (programming language)">Scheme</a>). </p> <div class="mw-heading mw-heading2"><h2 id="Interoperability_among_scripting_languages">Interoperability among scripting languages</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=12" title="Edit section: Interoperability among scripting languages"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Different scripting languages may share many common elements, largely due to being POSIX based, and some shells offer modes to emulate different shells. This allows a shell script written in one scripting language to be adapted into another. </p><p>One example of this is Bash, which offers the same grammar and syntax as the Bourne shell, and which also provides a POSIX-compliant mode.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup> As such, most shell scripts written for the Bourne shell can be run in BASH, but the reverse may not be true since BASH has extensions which are not present in the Bourne shell. As such, these features are known as <a href="https://en.wiktionary.org/wiki/bashism" class="extiw" title="wikt:bashism">bashisms</a>.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">[</span>14<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="Shell_scripting_on_other_operating_systems">Shell scripting on other operating systems</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=13" title="Edit section: Shell scripting on other operating systems"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Interoperability software such as <a href="/wiki/Cygwin" title="Cygwin">Cygwin</a>, the <a href="/wiki/MKS_Toolkit" title="MKS Toolkit">MKS Toolkit</a>, <a href="/wiki/Interix" title="Interix">Interix</a> (which is available in the Microsoft Windows Services for UNIX), <a href="/wiki/Hamilton_C_shell" title="Hamilton C shell">Hamilton C shell</a>, <a href="/wiki/UWIN" title="UWIN">UWIN</a> (AT&T Unix for Windows) and others allow Unix shell programs to be run on machines running Windows NT and its successors, with some loss of functionality on the <a href="/wiki/MS-DOS" title="MS-DOS">MS-DOS</a>-<a href="/wiki/Windows_95" title="Windows 95">Windows 95</a> branch, as well as earlier MKS Toolkit versions for OS/2. At least three DCL implementations for Windows type operating systems—in addition to <a href="/wiki/XLNT" title="XLNT">XLNT</a>, a multiple-use scripting language package which is used with the command shell, <a href="/wiki/Windows_Script_Host" title="Windows Script Host">Windows Script Host</a> and <a href="/wiki/Common_Gateway_Interface" title="Common Gateway Interface">CGI</a> programming—are available for these systems as well. Mac OS X and subsequent are Unix-like as well.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">[</span>15<span class="cite-bracket">]</span></a></sup> </p><p>In addition to the aforementioned tools, some <a href="/wiki/POSIX" title="POSIX">POSIX</a> and OS/2 functionality can be used with the corresponding environmental subsystems of the Windows NT operating system series up to Windows 2000 as well. A third, <a href="/wiki/16-bit_computing" title="16-bit computing">16-bit</a> subsystem often called the MS-DOS subsystem uses the Command.com provided with these operating systems to run the aforementioned MS-DOS batch files.<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">[</span>16<span class="cite-bracket">]</span></a></sup> </p><p>The console alternatives <a href="/wiki/4DOS" title="4DOS">4DOS</a>, <a href="/wiki/4OS2" title="4OS2">4OS2</a>, <a href="/wiki/FreeDOS" title="FreeDOS">FreeDOS</a>, <a href="/wiki/Peter_Norton" title="Peter Norton">Peter Norton</a>'s <a href="/wiki/NDOS" class="mw-redirect" title="NDOS">NDOS</a> and <a href="/w/index.php?title=Take_Command_Console)&action=edit&redlink=1" class="new" title="Take Command Console) (page does not exist)">4NT / Take Command</a> which add functionality to the Windows NT-style cmd.exe, MS-DOS/Windows 95 batch files (run by Command.com), OS/2's cmd.exe, and 4NT respectively are similar to the shells that they enhance and are more integrated with the Windows Script Host, which comes with three pre-installed engines, VBScript, <a href="/wiki/JScript" title="JScript">JScript</a>, and <a href="/wiki/Visual_Basic_for_Applications" title="Visual Basic for Applications">VBA</a> and to which numerous third-party engines can be added, with Rexx, Perl, Python, Ruby, and Tcl having pre-defined functions in 4NT and related programs. <a href="/wiki/PC_DOS" class="mw-redirect" title="PC DOS">PC DOS</a> is quite similar to MS-DOS, whilst <a href="/wiki/DR_DOS" class="mw-redirect" title="DR DOS">DR DOS</a> is more different. Earlier versions of Windows NT are able to run contemporary versions of 4OS2 by the OS/2 subsystem. </p><p>Scripting languages are, by definition, able to be extended; for example, a MS-DOS/Windows 95/98 and Windows NT type systems allows for shell/batch programs to call tools like <a href="/wiki/KiXtart" title="KiXtart">KiXtart</a>, <a href="/wiki/QBasic" title="QBasic">QBasic</a>, various <a href="/wiki/BASIC" title="BASIC">BASIC</a>, <a href="/wiki/Rexx" title="Rexx">Rexx</a>, <a href="/wiki/Perl" title="Perl">Perl</a>, and <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a> implementations, the <a href="/wiki/Windows_Script_Host" title="Windows Script Host">Windows Script Host</a> and its installed engines. On Unix and other <a href="/wiki/POSIX" title="POSIX">POSIX</a>-compliant systems, <a href="/wiki/Awk" class="mw-redirect" title="Awk">awk</a> and <a href="/wiki/Sed" title="Sed">sed</a> are used to extend the string and numeric processing ability of shell scripts. <a href="/wiki/Tcl" title="Tcl">Tcl</a>, Perl, Rexx, and Python have graphics toolkits and can be used to code functions and procedures for shell scripts which pose a speed bottleneck (C, Fortran, assembly language &c are much faster still) and to add functionality not available in the shell language such as sockets and other connectivity functions, heavy-duty text processing, working with numbers if the calling script does not have those abilities, self-writing and self-modifying code, techniques like <a href="/wiki/Recursion" title="Recursion">recursion</a>, direct memory access, various types of <a href="/wiki/Sorting" title="Sorting">sorting</a> and more, which are difficult or impossible in the main script, and so on. <a href="/wiki/Visual_Basic_for_Applications" title="Visual Basic for Applications">Visual Basic for Applications</a> and <a href="/wiki/VBScript" title="VBScript">VBScript</a> can be used to control and communicate with such things as spreadsheets, databases, scriptable programs of all types, telecommunications software, development tools, graphics tools and other software which can be accessed through the <a href="/wiki/Component_Object_Model" title="Component Object Model">Component Object Model</a>. </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=14" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Glue_code" title="Glue code">Glue code</a></li> <li><a href="/wiki/Interpreter_directive" title="Interpreter directive">Interpreter directive</a></li> <li><a href="/wiki/Shebang_(Unix)" title="Shebang (Unix)">Shebang symbol (#!)</a></li> <li><a href="/wiki/Unix_shell" title="Unix shell">Unix shells</a></li> <li><a href="/wiki/PowerShell" title="PowerShell">PowerShell</a></li> <li><a href="/wiki/Windows_Script_Host" title="Windows Script Host">Windows Script Host</a></li></ul> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=15" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="reflist"> <div class="mw-references-wrap mw-references-columns"><ol class="references"> <li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite id="CITEREFKernighanPike1984" class="citation cs2"><a href="/wiki/Brian_Kernighan" title="Brian Kernighan">Kernighan, Brian W.</a>; <a href="/wiki/Rob_Pike" title="Rob Pike">Pike, Rob</a> (1984), "3. Using the Shell", <i>The UNIX Programming Environment</i>, Prentice Hall, Inc., p. 94, <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/0-13-937699-2" title="Special:BookSources/0-13-937699-2"><bdi>0-13-937699-2</bdi></a>, <q>The shell is actually a programming language: it has variables, loops, decision-making, and so on.</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=3.+Using+the+Shell&rft.btitle=The+UNIX+Programming+Environment&rft.pages=94&rft.pub=Prentice+Hall%2C+Inc.&rft.date=1984&rft.isbn=0-13-937699-2&rft.aulast=Kernighan&rft.aufirst=Brian+W.&rft.au=Pike%2C+Rob&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-Pro_Bash_Programming-2"><span class="mw-cite-backlink">^ <a href="#cite_ref-Pro_Bash_Programming_2-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Pro_Bash_Programming_2-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFJohnson2009" class="citation book cs1">Johnson, Chris (2009). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=NJmhi6T0nGMC&q=comment"><i>Pro Bash Programming: Scripting the Linux Shell</i></a>. Apress. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/9781430219989" title="Special:BookSources/9781430219989"><bdi>9781430219989</bdi></a><span class="reference-accessdate">. Retrieved <span class="nowrap">September 27,</span> 2019</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Pro+Bash+Programming%3A+Scripting+the+Linux+Shell&rft.pub=Apress&rft.date=2009&rft.isbn=9781430219989&rft.aulast=Johnson&rft.aufirst=Chris&rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3DNJmhi6T0nGMC%26q%3Dcomment&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://linux.die.net/man/3/execve">"exec(3p) – POSIX Programmer's Manual"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">2020-07-24</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=exec%283p%29+%E2%80%93+POSIX+Programmer%27s+Manual&rft_id=https%3A%2F%2Flinux.die.net%2Fman%2F3%2Fexecve&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text">Unix Shells By Example, pp 7-10,</span> </li> <li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text">Programming Perl, 5th Edition, preface</span> </li> <li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://manned.org/osh/f30afb07">"osh - manned.org"</a>. <i>manned.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2019-01-16</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=manned.org&rft.atitle=osh+-+manned.org&rft_id=https%3A%2F%2Fmanned.org%2Fosh%2Ff30afb07&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFRobbinsHannahLamb2008" class="citation book cs1">Robbins, Arnold; Hannah, Elbert; Lamb, Linda (2008). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=J5nKVVg5YHAC"><i>Learning the vi and Vim Editors</i></a>. "O'Reilly Media, Inc.". p. 205. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/9781449313258" title="Special:BookSources/9781449313258"><bdi>9781449313258</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Learning+the+vi+and+Vim+Editors&rft.pages=205&rft.pub=%22O%27Reilly+Media%2C+Inc.%22&rft.date=2008&rft.isbn=9781449313258&rft.aulast=Robbins&rft.aufirst=Arnold&rft.au=Hannah%2C+Elbert&rft.au=Lamb%2C+Linda&rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3DJ5nKVVg5YHAC&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFEasttom2012" class="citation book cs1">Easttom, Chuck (2012). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=zZYLAAAAQBAJ"><i>Essential Linux Administration:: A Comprehensive Guide for Beginners</i></a>. Course Technology/Cengage Learning. p. 228. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-1435459571" title="Special:BookSources/978-1435459571"><bdi>978-1435459571</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Essential+Linux+Administration%3A%3A+A+Comprehensive+Guide+for+Beginners&rft.pages=228&rft.pub=Course+Technology%2FCengage+Learning&rft.date=2012&rft.isbn=978-1435459571&rft.aulast=Easttom&rft.aufirst=Chuck&rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3DzZYLAAAAQBAJ&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFKumari2015" class="citation book cs1">Kumari, Sinny (November 23, 2015). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=9vCoCwAAQBAJ&q=shell+script+file+extension&pg=PA2"><i>Linux Shell Scripting Essentials</i></a>. Packt Publishing Ltd. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/9781783552375" title="Special:BookSources/9781783552375"><bdi>9781783552375</bdi></a><span class="reference-accessdate">. Retrieved <span class="nowrap">May 7,</span> 2017</span>. <q>Rather than using a file extension for shell scripts, it's preferred to keep a filename without extension and let an interpreter identify the type by looking into shebang(#!).</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Linux+Shell+Scripting+Essentials&rft.pub=Packt+Publishing+Ltd&rft.date=2015-11-23&rft.isbn=9781783552375&rft.aulast=Kumari&rft.aufirst=Sinny&rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3D9vCoCwAAQBAJ%26q%3Dshell%2Bscript%2Bfile%2Bextension%26pg%3DPA2&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFTaylorPerry2016" class="citation book cs1">Taylor, Dave; Perry, Brandon (December 16, 2016). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=Mpi7DQAAQBAJ&q=shell+script+file+extension&pg=PA5"><i>Wicked Cool Shell Scripts, 2nd Edition: 101 Scripts for Linux, OS X and UNIX Systems</i></a>. No Starch Press. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/9781593276027" title="Special:BookSources/9781593276027"><bdi>9781593276027</bdi></a><span class="reference-accessdate">. Retrieved <span class="nowrap">May 7,</span> 2017</span>. <q>Shell scripts don't need a special file extension, so leave the extension blank (or you can add the extension .sh if you prefer, but this isn't required.</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Wicked+Cool+Shell+Scripts%2C+2nd+Edition%3A+101+Scripts+for+Linux%2C+OS+X+and+UNIX+Systems&rft.pub=No+Starch+Press&rft.date=2016-12-16&rft.isbn=9781593276027&rft.aulast=Taylor&rft.aufirst=Dave&rft.au=Perry%2C+Brandon&rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3DMpi7DQAAQBAJ%26q%3Dshell%2Bscript%2Bfile%2Bextension%26pg%3DPA5&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFLarry_Wall1991" class="citation newsgroup cs1"><a href="/wiki/Larry_Wall" title="Larry Wall">Larry Wall</a> (January 4, 1991). <a rel="nofollow" class="external text" href="https://www.tuhs.org/Usenet/comp.unix.shell/1991-January/002464.html">"Finding the last arg"</a>. <a href="/wiki/Usenet_newsgroup" title="Usenet newsgroup">Newsgroup</a>: <a rel="nofollow" class="external text" href="news:comp.unix.shell">comp.unix.shell</a><span class="reference-accessdate">. Retrieved <span class="nowrap">January 5,</span> 2023</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Finding+the+last+arg&rft.pub=comp.unix.shell&rft.date=1991-01-04&rft.au=Larry+Wall&rft_id=https%3A%2F%2Fwww.tuhs.org%2FUsenet%2Fcomp.unix.shell%2F1991-January%2F002464.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFChristiansen,_Tom" class="citation web cs1">Christiansen, Tom. <a rel="nofollow" class="external text" href="https://www.ooblick.com/text/CshProgrammingConsideredHarmful.html">"Csh Programming Considered Harmful"</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Csh+Programming+Considered+Harmful&rft.au=Christiansen%2C+Tom&rft_id=https%3A%2F%2Fwww.ooblick.com%2Ftext%2FCshProgrammingConsideredHarmful.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.gnu.org/software/bash/manual/html_node/Major-Differences-From-The-Bourne-Shell.html">"Major Differences From The Bourne Shell"</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Major+Differences+From+The+Bourne+Shell&rft_id=https%3A%2F%2Fwww.gnu.org%2Fsoftware%2Fbash%2Fmanual%2Fhtml_node%2FMajor-Differences-From-The-Bourne-Shell.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://betterprogramming.pub/24-bashism-to-avoid-for-posix-compliant-shell-scripts-8e7c09e0f49a">"24 Bashism To Avoid for POSIX-Compliant Shell Scripts"</a>. 18 May 2022.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=24+Bashism+To+Avoid+for+POSIX-Compliant+Shell+Scripts&rft.date=2022-05-18&rft_id=https%3A%2F%2Fbetterprogramming.pub%2F24-bashism-to-avoid-for-posix-compliant-shell-scripts-8e7c09e0f49a&rfr_id=info%3Asid%2Fen.wikipedia.org%3AShell+script" class="Z3988"></span></span> </li> <li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text">MSDN<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Verifiability" title="Wikipedia:Verifiability"><span title="The citation is not specific enough to facilitate source verification (May 2017)">not specific enough to verify</span></a></i>]</sup></span> </li> <li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text">Windows NT 4 Workstation Resource Kit</span> </li> </ol></div></div> <div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Shell_script&action=edit&section=16" title="Edit section: External links"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1235681985">.mw-parser-output .side-box{margin:4px 0;box-sizing:border-box;border:1px solid #aaa;font-size:88%;line-height:1.25em;background-color:var(--background-color-interactive-subtle,#f8f9fa);display:flow-root}.mw-parser-output .side-box-abovebelow,.mw-parser-output .side-box-text{padding:0.25em 0.9em}.mw-parser-output .side-box-image{padding:2px 0 2px 0.9em;text-align:center}.mw-parser-output .side-box-imageright{padding:2px 0.9em 2px 0;text-align:center}@media(min-width:500px){.mw-parser-output .side-box-flex{display:flex;align-items:center}.mw-parser-output .side-box-text{flex:1;min-width:0}}@media(min-width:720px){.mw-parser-output .side-box{width:238px}.mw-parser-output .side-box-right{clear:right;float:right;margin-left:1em}.mw-parser-output .side-box-left{margin-right:1em}}</style><style data-mw-deduplicate="TemplateStyles:r1237033735">@media print{body.ns-0 .mw-parser-output .sistersitebox{display:none!important}}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}</style><div class="side-box side-box-right plainlinks sistersitebox"><style data-mw-deduplicate="TemplateStyles:r1126788409">.mw-parser-output .plainlist ol,.mw-parser-output .plainlist ul{line-height:inherit;list-style:none;margin:0;padding:0}.mw-parser-output .plainlist ol li,.mw-parser-output .plainlist ul li{margin-bottom:0}</style> <div class="side-box-flex"> <div class="side-box-image"><span class="noviewer" typeof="mw:File"><a href="/wiki/File:Wikibooks-logo-en-noslogan.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/40px-Wikibooks-logo-en-noslogan.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/60px-Wikibooks-logo-en-noslogan.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/80px-Wikibooks-logo-en-noslogan.svg.png 2x" data-file-width="400" data-file-height="400" /></a></span></div> <div class="side-box-text plainlist">Wikibooks has a book on the topic of: <i><b><a href="https://en.wikibooks.org/wiki/Shell_Programming" class="extiw" title="wikibooks:Shell Programming">Shell Programming</a></b></i></div></div> </div> <ul><li><a rel="nofollow" class="external text" href="http://www.faqs.org/docs/air/tsshell.html"><i>An Introduction To Shell Programming</i> by Greg Goebel</a></li> <li><a rel="nofollow" class="external text" href="https://www.shellscript.sh"><i>UNIX / Linux shell scripting tutorial</i> by Steve Parker</a></li> <li><a rel="nofollow" class="external text" href="https://developer.apple.com/mac/library/documentation/OpenSource/Conceptual/ShellScripting/"><i>Shell Scripting Primer</i> (Apple)</a></li> <li><a rel="nofollow" class="external text" href="https://www.linux.com/articles/34658"><i>What to watch out for when writing portable shell scripts</i> by Peter Seebach</a></li> <li><a rel="nofollow" class="external text" href="http://freebookcentre.net/UnixCategory/Free-Unix-Shell-Programming-Books-Download.html">Free Unix Shell scripting books</a></li> <li><a rel="nofollow" class="external text" href="https://help.ubuntu.com/community/Beginners/BashScripting">Beginners/BashScripting</a>, Ubuntu Linux</li></ul> <div class="navbox-styles"><style data-mw-deduplicate="TemplateStyles:r1129693374">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}</style><style data-mw-deduplicate="TemplateStyles:r1236075235">.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}</style></div><div role="navigation" class="navbox" aria-labelledby="Programming_languages625" style="padding:3px"><table class="nowraplinks hlist mw-collapsible expanded navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><style data-mw-deduplicate="TemplateStyles:r1239400231">.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}</style><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:Programming_languages" title="Template:Programming languages"><abbr title="View this template">v</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Programming_languages" title="Template talk:Programming languages"><abbr title="Discuss this template">t</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:EditPage/Template:Programming_languages" title="Special:EditPage/Template:Programming languages"><abbr title="Edit this template">e</abbr></a></li></ul></div><div id="Programming_languages625" style="font-size:114%;margin:0 4em"><a href="/wiki/Programming_language" title="Programming language">Programming languages</a></div></th></tr><tr><td class="navbox-abovebelow" colspan="2"><div> <ul><li><a href="/wiki/Comparison_of_programming_languages" title="Comparison of programming languages">Comparison</a></li> <li><a href="/wiki/Timeline_of_programming_languages" title="Timeline of programming languages">Timeline</a></li> <li><a href="/wiki/History_of_programming_languages" title="History of programming languages">History</a></li></ul> </div></td></tr><tr><td colspan="2" class="navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Ada_(programming_language)" title="Ada (programming language)">Ada</a></li> <li><a href="/wiki/ALGOL" title="ALGOL">ALGOL</a> <ul><li><a href="/wiki/Simula" title="Simula">Simula</a></li></ul></li> <li><a href="/wiki/APL_(programming_language)" title="APL (programming language)">APL</a></li> <li><a href="/wiki/Assembly_language" title="Assembly language">Assembly</a></li> <li><a href="/wiki/BASIC" title="BASIC">BASIC</a> <ul><li><a href="/wiki/Visual_Basic" title="Visual Basic">Visual Basic</a> <ul><li><a href="/wiki/Visual_Basic_(classic)" title="Visual Basic (classic)">classic</a></li> <li><a href="/wiki/Visual_Basic_(.NET)" title="Visual Basic (.NET)">.NET</a></li></ul></li></ul></li> <li><a href="/wiki/C_(programming_language)" title="C (programming language)">C</a></li> <li><a href="/wiki/C%2B%2B" title="C++">C++</a></li> <li><a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a></li> <li><a href="/wiki/COBOL" title="COBOL">COBOL</a></li> <li><a href="/wiki/Erlang_(programming_language)" title="Erlang (programming language)">Erlang</a></li> <li><a href="/wiki/Forth_(programming_language)" title="Forth (programming language)">Forth</a></li> <li><a href="/wiki/Fortran" title="Fortran">Fortran</a></li> <li><a href="/wiki/Go_(programming_language)" title="Go (programming language)">Go</a></li> <li><a href="/wiki/Haskell" title="Haskell">Haskell</a></li> <li><a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a></li> <li><a href="/wiki/JavaScript" title="JavaScript">JavaScript</a></li> <li><a href="/wiki/Julia_(programming_language)" title="Julia (programming language)">Julia</a></li> <li><a href="/wiki/Kotlin_(programming_language)" title="Kotlin (programming language)">Kotlin</a></li> <li><a href="/wiki/Lisp_(programming_language)" title="Lisp (programming language)">Lisp</a></li> <li><a href="/wiki/Lua_(programming_language)" title="Lua (programming language)">Lua</a></li> <li><a href="/wiki/MATLAB" title="MATLAB">MATLAB</a></li> <li><a href="/wiki/ML_(programming_language)" title="ML (programming language)">ML</a></li> <li><a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a> <ul><li><a href="/wiki/Object_Pascal" title="Object Pascal">Object Pascal</a></li></ul></li> <li><a href="/wiki/Perl" title="Perl">Perl</a></li> <li><a href="/wiki/PHP" title="PHP">PHP</a></li> <li><a href="/wiki/Prolog" title="Prolog">Prolog</a></li> <li><a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a></li> <li><a href="/wiki/R_(programming_language)" title="R (programming language)">R</a></li> <li><a href="/wiki/Ruby_(programming_language)" title="Ruby (programming language)">Ruby</a></li> <li><a href="/wiki/Rust_(programming_language)" title="Rust (programming language)">Rust</a></li> <li><a href="/wiki/SQL" title="SQL">SQL</a></li> <li><a href="/wiki/Scratch_(programming_language)" title="Scratch (programming language)">Scratch</a></li> <li><a class="mw-selflink selflink">Shell</a></li> <li><a href="/wiki/Smalltalk" title="Smalltalk">Smalltalk</a></li> <li><a href="/wiki/Swift_(programming_language)" title="Swift (programming language)">Swift</a></li> <li><i><a href="/wiki/List_of_programming_languages" title="List of programming languages">more...</a></i></li></ul> </div></td></tr><tr><td class="navbox-abovebelow" colspan="2"><div> <ul><li><span class="noviewer" typeof="mw:File"><span title="List-Class article"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/16px-Symbol_list_class.svg.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/23px-Symbol_list_class.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/31px-Symbol_list_class.svg.png 2x" data-file-width="180" data-file-height="185" /></span></span> <b>Lists:</b> <a href="/wiki/List_of_programming_languages" title="List of programming languages">Alphabetical</a></li> <li><a href="/wiki/List_of_programming_languages_by_type" title="List of programming languages by type">Categorical</a></li> <li><a href="/wiki/Generational_list_of_programming_languages" title="Generational list of programming languages">Generational</a></li> <li><a href="/wiki/Non-English-based_programming_languages" title="Non-English-based programming languages">Non-English-based</a></li> <li><span class="noviewer" typeof="mw:File"><span title="Category"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/23px-Symbol_category_class.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/31px-Symbol_category_class.svg.png 2x" data-file-width="180" data-file-height="185" /></span></span> <a href="/wiki/Category:Programming_languages" title="Category:Programming languages">Category</a></li></ul> </div></td></tr></tbody></table></div> <!-- NewPP limit report Parsed by mw‐api‐int.codfw.main‐6c4b4c4bd6‐gxxx9 Cached time: 20250210045031 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.470 seconds Real time usage: 0.690 seconds Preprocessor visited node count: 1378/1000000 Post‐expand include size: 44277/2097152 bytes Template argument size: 1522/2097152 bytes Highest expansion depth: 14/100 Expensive parser function count: 13/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 60352/5000000 bytes Lua time usage: 0.303/10.000 seconds Lua memory usage: 6414429/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 521.969 1 -total 36.34% 189.692 1 Template:Reflist 20.01% 104.440 1 Template:Programming_languages 19.65% 102.573 1 Template:Navbox 19.24% 100.408 1 Template:Citation 15.13% 78.963 1 Template:Short_description 12.64% 65.995 1 Template:Refimprove 11.43% 59.657 1 Template:Ambox 9.13% 47.652 2 Template:Pagetype 6.16% 32.172 1 Template:About --> <!-- Saved in parser cache with key enwiki:pcache:28938:|#|:idhash:canonical and timestamp 20250210045031 and revision id 1259032770. Rendering was triggered because: api-parse --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?useformat=desktop&type=1x1&usesul3=0" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=Shell_script&oldid=1259032770">https://en.wikipedia.org/w/index.php?title=Shell_script&oldid=1259032770</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Category</a>: <ul><li><a href="/wiki/Category:Scripting_languages" title="Category:Scripting languages">Scripting languages</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:Wikipedia_articles_needing_factual_verification_from_May_2017" title="Category:Wikipedia articles needing factual verification from May 2017">Wikipedia articles needing factual verification from May 2017</a></li><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_matches_Wikidata" title="Category:Short description matches Wikidata">Short description matches Wikidata</a></li><li><a href="/wiki/Category:Articles_needing_additional_references_from_February_2014" title="Category:Articles needing additional references from February 2014">Articles needing additional references from February 2014</a></li><li><a href="/wiki/Category:All_articles_needing_additional_references" title="Category:All articles needing additional references">All articles needing additional references</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 23 November 2024, at 00:40<span class="anonymous-show"> (UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=Shell_script&mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" lang="en" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-header-container vector-sticky-header-container"> <div id="vector-sticky-header" class="vector-sticky-header"> <div class="vector-sticky-header-start"> <div class="vector-sticky-header-icon-start vector-button-flush-left vector-button-flush-right" aria-hidden="true"> <button class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-sticky-header-search-toggle" tabindex="-1" data-event-name="ui.vector-sticky-search-form.icon"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </button> </div> <div role="search" class="vector-search-box-vue vector-search-box-show-thumbnail vector-search-box"> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail"> <form action="/w/index.php" id="vector-sticky-search-form" class="cdx-search-input cdx-search-input--has-end-button"> <div class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia"> <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <div class="vector-sticky-header-context-bar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-sticky-header-toc" class="vector-dropdown mw-portlet mw-portlet-sticky-header-toc vector-sticky-header-toc vector-button-flush-left" > <input type="checkbox" id="vector-sticky-header-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-sticky-header-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-sticky-header-toc-label" for="vector-sticky-header-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-sticky-header-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div class="vector-sticky-header-context-bar-primary" aria-hidden="true" ><span class="mw-page-title-main">Shell script</span></div> </div> </div> <div class="vector-sticky-header-end" aria-hidden="true"> <div class="vector-sticky-header-icons"> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-talk-sticky-header" tabindex="-1" data-event-name="talk-sticky-header"><span class="vector-icon mw-ui-icon-speechBubbles mw-ui-icon-wikimedia-speechBubbles"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-subject-sticky-header" tabindex="-1" data-event-name="subject-sticky-header"><span class="vector-icon mw-ui-icon-article mw-ui-icon-wikimedia-article"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-history-sticky-header" tabindex="-1" data-event-name="history-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-history mw-ui-icon-wikimedia-wikimedia-history"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only mw-watchlink" id="ca-watchstar-sticky-header" tabindex="-1" data-event-name="watch-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-star mw-ui-icon-wikimedia-wikimedia-star"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-edit-sticky-header" tabindex="-1" data-event-name="wikitext-edit-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-wikiText mw-ui-icon-wikimedia-wikimedia-wikiText"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-ve-edit-sticky-header" tabindex="-1" data-event-name="ve-edit-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-edit mw-ui-icon-wikimedia-wikimedia-edit"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-viewsource-sticky-header" tabindex="-1" data-event-name="ve-edit-protected-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-editLock mw-ui-icon-wikimedia-wikimedia-editLock"></span> <span></span> </a> </div> <div class="vector-sticky-header-buttons"> <button class="cdx-button cdx-button--weight-quiet mw-interlanguage-selector" id="p-lang-btn-sticky-header" tabindex="-1" data-event-name="ui.dropdown-p-lang-btn-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-language mw-ui-icon-wikimedia-wikimedia-language"></span> <span>20 languages</span> </button> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive" id="ca-addsection-sticky-header" tabindex="-1" data-event-name="addsection-sticky-header"><span class="vector-icon mw-ui-icon-speechBubbleAdd-progressive mw-ui-icon-wikimedia-speechBubbleAdd-progressive"></span> <span>Add topic</span> </a> </div> <div class="vector-sticky-header-icon-end"> <div class="vector-user-links"> </div> </div> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-84749c7844-zmqjx","wgBackendResponseTime":144,"wgPageParseReport":{"limitreport":{"cputime":"0.470","walltime":"0.690","ppvisitednodes":{"value":1378,"limit":1000000},"postexpandincludesize":{"value":44277,"limit":2097152},"templateargumentsize":{"value":1522,"limit":2097152},"expansiondepth":{"value":14,"limit":100},"expensivefunctioncount":{"value":13,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":60352,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 521.969 1 -total"," 36.34% 189.692 1 Template:Reflist"," 20.01% 104.440 1 Template:Programming_languages"," 19.65% 102.573 1 Template:Navbox"," 19.24% 100.408 1 Template:Citation"," 15.13% 78.963 1 Template:Short_description"," 12.64% 65.995 1 Template:Refimprove"," 11.43% 59.657 1 Template:Ambox"," 9.13% 47.652 2 Template:Pagetype"," 6.16% 32.172 1 Template:About"]},"scribunto":{"limitreport-timeusage":{"value":"0.303","limit":"10.000"},"limitreport-memusage":{"value":6414429,"limit":52428800}},"cachereport":{"origin":"mw-api-int.codfw.main-6c4b4c4bd6-gxxx9","timestamp":"20250210045031","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Shell script","url":"https:\/\/en.wikipedia.org\/wiki\/Shell_script","sameAs":"http:\/\/www.wikidata.org\/entity\/Q959549","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q959549","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2002-02-25T15:51:15Z","dateModified":"2024-11-23T00:40:35Z","image":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/f\/f0\/FreeBSD_10_vi_RC_Firewall.png","headline":"script written for the shell, or command line interpreter, of an operating system"}</script> </body> </html>