mirror of
https://github.com/rawiriblundell/wiki.bash-hackers.org
synced 2024-11-02 00:53:07 +01:00
318 lines
16 KiB
Plaintext
318 lines
16 KiB
Plaintext
|
<!DOCTYPE html>
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" class="no-js">
|
||
|
<head><script type="text/javascript" src="/_static/js/bundle-playback.js?v=TPXmWR5s" charset="utf-8"></script>
|
||
|
<script type="text/javascript" src="/_static/js/wombat.js?v=txqj7nKC" charset="utf-8"></script>
|
||
|
<script type="text/javascript">
|
||
|
__wm.init("http://web.archive.org/web");
|
||
|
__wm.wombat("http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=edit","20170629143024","http://web.archive.org/","web","/_static/",
|
||
|
"1498746624");
|
||
|
</script>
|
||
|
<link rel="stylesheet" type="text/css" href="/_static/css/banner-styles.css?v=S1zqJCYt" />
|
||
|
<link rel="stylesheet" type="text/css" href="/_static/css/iconochive.css?v=qtvMKcIJ" />
|
||
|
<!-- End Wayback Rewrite JS Include -->
|
||
|
|
||
|
<meta charset="UTF-8"/>
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||
|
<title>✎ User selections [Bash Hackers Wiki]</title>
|
||
|
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
|
||
|
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
||
|
<link rel="shortcut icon" href="/web/20170629143024im_/http://wiki.bash-hackers.org/lib/tpl/bootstrap3/images/favicon.ico"/>
|
||
|
<link rel="apple-touch-icon" href="/web/20170629143024im_/http://wiki.bash-hackers.org/lib/tpl/bootstrap3/images/apple-touch-icon.png"/>
|
||
|
<link type="text/css" rel="stylesheet" href="/web/20170629143024cs_/http://wiki.bash-hackers.org/lib/tpl/bootstrap3/assets/bootstrap/css/bootstrap.min.css"/>
|
||
|
<link type="text/css" rel="stylesheet" href="/web/20170629143024cs_/http://wiki.bash-hackers.org/lib/tpl/bootstrap3/assets/font-awesome/css/font-awesome.min.css"/>
|
||
|
<meta name="generator" content="DokuWiki"/>
|
||
|
<meta name="robots" content="noindex,nofollow"/>
|
||
|
<link rel="search" type="application/opensearchdescription+xml" href="/web/20170629143024/http://wiki.bash-hackers.org/lib/exe/opensearch.php" title="Bash Hackers Wiki"/>
|
||
|
<link rel="start" href="/"/>
|
||
|
<link rel="contents" href="/syntax/ccmd/user_select?do=index" title="Sitemap"/>
|
||
|
<link rel="alternate" type="application/rss+xml" title="Recent Changes" href="/web/20170629143024/http://wiki.bash-hackers.org/feed.php"/>
|
||
|
<link rel="alternate" type="application/rss+xml" title="Current namespace" href="/web/20170629143024/http://wiki.bash-hackers.org/feed.php?mode=list&ns=syntax:ccmd"/>
|
||
|
<link rel="alternate" type="text/html" title="Plain HTML" href="/web/20170629143024/http://wiki.bash-hackers.org/_export/xhtml/syntax/ccmd/user_select"/>
|
||
|
<link rel="alternate" type="text/plain" title="Wiki Markup" href="/web/20170629143024/http://wiki.bash-hackers.org/_export/raw/syntax/ccmd/user_select"/>
|
||
|
<link rel="stylesheet" type="text/css" href="/web/20170629143024cs_/http://wiki.bash-hackers.org/lib/exe/css.php?t=bootstrap3&tseed=528093e3aea33d6f7c530e5703af11d8"/>
|
||
|
<script type="text/javascript">/*<![CDATA[*/var NS='syntax:ccmd';var JSINFO = {"id":"syntax:ccmd:user_select","namespace":"syntax:ccmd","updatable":1,"isadmin":0,"isauth":0,"bootstrap3":{"tableFullWidth":1,"tableStyle":["striped","condensed","responsive"],"tagsOnTop":1,"useAnchorJS":1}};
|
||
|
/*!]]>*/</script>
|
||
|
<script type="text/javascript" charset="utf-8" src="/web/20170629143024js_/http://wiki.bash-hackers.org/lib/exe/js.php?t=bootstrap3&tseed=528093e3aea33d6f7c530e5703af11d8"></script>
|
||
|
<style type="text/css">
|
||
|
body { padding-top: 20px; }
|
||
|
.toc-affix { z-index: 9999; top: 10px; right: 10px; }
|
||
|
</style>
|
||
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||
|
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||
|
<!--[if lt IE 9]>
|
||
|
<script type="text/javascript" src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||
|
<script type="text/javascript" src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||
|
<![endif]-->
|
||
|
</head>
|
||
|
<body class="default page-on-panel">
|
||
|
<!--[if IE 8 ]><div id="IE8"><![endif]-->
|
||
|
<div id="dokuwiki__site" class="container">
|
||
|
<div id="dokuwiki__top" class="site dokuwiki mode_edit tpl_bootstrap3 ">
|
||
|
|
||
|
|
||
|
<!-- header -->
|
||
|
<div id="dokuwiki__header">
|
||
|
<nav class="navbar navbar-default" role="navigation">
|
||
|
|
||
|
<div class="container-fluid">
|
||
|
|
||
|
<div class="navbar-header">
|
||
|
|
||
|
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-collapse">
|
||
|
<span class="icon-bar"></span>
|
||
|
<span class="icon-bar"></span>
|
||
|
<span class="icon-bar"></span>
|
||
|
</button>
|
||
|
|
||
|
<a href="/web/20170629143024/http://wiki.bash-hackers.org/start" accesskey="h" title="[H]" class="navbar-brand"><img src="/web/20170629143024im_/http://wiki.bash-hackers.org/lib/tpl/bootstrap3/images/logo.png" alt="Bash Hackers Wiki" class="pull-left" id="dw__logo" height="20"/> <span id="dw__title">Bash Hackers Wiki</span></a>
|
||
|
</div>
|
||
|
|
||
|
<div class="collapse navbar-collapse">
|
||
|
|
||
|
|
||
|
<ul class="nav navbar-nav">
|
||
|
<li>
|
||
|
<a href="/web/20170629143024/http://wiki.bash-hackers.org/start"><i class="fa fa-fw fa-home"></i> Home</a></li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="navbar-right">
|
||
|
|
||
|
<form action="/web/20170629143024/http://wiki.bash-hackers.org/start" accept-charset="utf-8" class="navbar-form navbar-left search" id="dw__search" method="get" role="search"><div class="no"><div class="form-group"><input type="hidden" name="do" value="search"/><input id="qsearch__in" type="search" placeholder="Search" accesskey="f" name="id" class="edit form-control" title="[F]"/></div> <button type="submit" class="btn btn-default" title="Search"><i class="fa fa-fw fa-search"></i><span class="hidden-lg hidden-md hidden-sm"> Search</span></button><div id="qsearch__out" class="panel panel-default ajax_qsearch JSpopup"></div></div></form>
|
||
|
|
||
|
<ul class="nav navbar-nav" id="dw__tools">
|
||
|
|
||
|
|
||
|
<li class="dropdown">
|
||
|
|
||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" title="">
|
||
|
<i class="fa fa-fw fa-wrench"></i> <span class="hidden-lg hidden-md hidden-sm">Tools</span> <span class="caret"></span>
|
||
|
</a>
|
||
|
|
||
|
<ul class="dropdown-menu tools" role="menu">
|
||
|
|
||
|
<li class="dropdown-header">
|
||
|
<i class="fa fa-fw fa-wrench"></i> Site Tools </li>
|
||
|
<li><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=recent" class="action recent" accesskey="r" rel="nofollow" title="Recent Changes [R]"><i class="fa fa-fw fa-list-alt"></i> Recent Changes</a></li><li><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=media&ns=syntax%3Accmd" class="action media" rel="nofollow" title="Media Manager"><i class="fa fa-fw fa-picture-o"></i> Media Manager</a></li><li><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=index" class="action index" accesskey="x" rel="nofollow" title="Sitemap [X]"><i class="fa fa-fw fa-sitemap"></i> Sitemap</a></li>
|
||
|
<li class="divider" role="separator"></li>
|
||
|
|
||
|
|
||
|
<li class="dropdown-header">
|
||
|
<i class="fa fa-fw fa-file"></i> Page Tools </li>
|
||
|
<li class="active"><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=" class="action show" accesskey="v" rel="nofollow" title="Show page [V]"><i class="fa fa-fw fa-file-text-o"></i> Show page</a></li><li><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=revisions" class="action revs" accesskey="o" rel="nofollow" title="Old revisions [O]"><i class="fa fa-fw fa-clock-o"></i> Old revisions</a></li><li><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=backlink" class="action backlink" rel="nofollow" title="Backlinks"><i class="fa fa-fw fa-link"></i> Backlinks</a></li><li><a href="#dokuwiki__top" class="action top" accesskey="t" rel="nofollow" title="Back to top [T]"><i class="fa fa-fw fa-chevron-up"></i> Back to top</a></li>
|
||
|
|
||
|
</ul>
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
<ul class="nav navbar-nav">
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<span class="dw__actions">
|
||
|
<a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=register" class="action register" rel="nofollow" title="Register"><i class="fa fa-fw fa-user-plus"></i> Register</a><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=login&sectok=c9fb1a546df80dbfb5e2b697303324a1" class="action login" rel="nofollow" title="Log In"><i class="fa fa-fw fa-sign-in"></i> Log In</a> </span>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</nav>
|
||
|
|
||
|
</div>
|
||
|
<!-- /header -->
|
||
|
|
||
|
<div align="center">
|
||
|
<script async src="//web.archive.org/web/20170629143024js_/http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
||
|
<!-- BHORG_BOTTOM -->
|
||
|
<ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-4658830517838678" data-ad-slot="1603598940"></ins>
|
||
|
<script>
|
||
|
(adsbygoogle = window.adsbygoogle || []).push({});
|
||
|
</script>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div id="dw__breadcrumbs">
|
||
|
<hr/>
|
||
|
<div class="dw__youarehere">
|
||
|
<ol class="breadcrumb"><li>You are here:</li><li><a href="/web/20170629143024/http://wiki.bash-hackers.org/start" title="start"><i class="fa fa-fw fa-home"></i></a></li><li><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/start" class="wikilink1" title="syntax:start">Syntax</a></li><li><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/start" class="wikilink1" title="syntax:ccmd:start">Compound Commands</a></li><li class="active">✎ User selections</li></ol> </div>
|
||
|
<div class="dw__breadcrumbs hidden-print">
|
||
|
<ol class="breadcrumb"><li>Trace:</li> </div>
|
||
|
<hr/>
|
||
|
</div>
|
||
|
|
||
|
<p class="pageId text-right">
|
||
|
<span class="label label-primary">syntax:ccmd:user_select</span> </p>
|
||
|
|
||
|
<div id="dw__msgarea">
|
||
|
</div>
|
||
|
|
||
|
<main class="main row" role="main">
|
||
|
|
||
|
|
||
|
<!-- ********** CONTENT ********** -->
|
||
|
<article id="dokuwiki__content" class="container">
|
||
|
|
||
|
<div class="panel panel-default">
|
||
|
<div class="page panel-body">
|
||
|
|
||
|
<div class="pull-right hidden-print">
|
||
|
<div class="toc-affix" data-spy="affix" data-offset-top="150">
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<p>
|
||
|
This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong.
|
||
|
</p>
|
||
|
<div class="editBox" role="application">
|
||
|
|
||
|
<div class="toolbar group">
|
||
|
<div id="draft__status"></div>
|
||
|
<div id="tool__bar"></div>
|
||
|
</div>
|
||
|
<form id="dw__editform" method="post" action="" accept-charset="utf-8"><div class="no">
|
||
|
<input type="hidden" name="sectok" value="c9fb1a546df80dbfb5e2b697303324a1"/><input type="hidden" name="id" value="syntax:ccmd:user_select"/><input type="hidden" name="rev" value="0"/><input type="hidden" name="date" value="1286911632"/><input type="hidden" name="prefix" value="."/><input type="hidden" name="suffix" value=""/><input type="hidden" name="changecheck" value="6da75a11ac937ab8940d17da0926872d"/><input type="hidden" name="target" value="section"/><textarea name="wikitext" id="wiki__text" dir="auto" class="edit" cols="80" rows="10" tabindex="1" readonly="readonly">
|
||
|
====== User selections ======
|
||
|
|
||
|
===== Synopsis =====
|
||
|
<code>
|
||
|
select <NAME>; do
|
||
|
<LIST>
|
||
|
done
|
||
|
</code>
|
||
|
|
||
|
<code>
|
||
|
select <NAME> in <WORDS>; do
|
||
|
<LIST>
|
||
|
done
|
||
|
</code>
|
||
|
|
||
|
<code>
|
||
|
# alternative, historical and undocumented syntax
|
||
|
|
||
|
select <NAME>
|
||
|
{
|
||
|
<LIST>
|
||
|
}
|
||
|
|
||
|
select <NAME> in <WORDS>
|
||
|
{
|
||
|
<LIST>
|
||
|
}
|
||
|
</code>
|
||
|
|
||
|
===== Description =====
|
||
|
This compound command provides a kind of menu. The user is prompted with a //numbered list// of the given words, and is asked to input the index number of the word. If a word was selected, the variable ''<NAME>'' is set to this word, and the [[syntax:basicgrammar#lists | list]] ''<LIST>'' is executed.
|
||
|
|
||
|
If no ''in <WORDS>'' is given, then the positional parameters are taken as words (as if ''in "$@"'' was written).
|
||
|
|
||
|
Regardless of the functionality, the //number// the user entered is saved in the variable ''REPLY''.
|
||
|
|
||
|
Bash knows an alternative syntax for the ''select'' command, enclosing the loop body in ''{<nowiki>...</nowiki>}'' instead of ''do <nowiki>...</nowiki> done'':
|
||
|
<code>
|
||
|
select x in 1 2 3
|
||
|
{
|
||
|
echo $x
|
||
|
}
|
||
|
</code>
|
||
|
This syntax is **not documented** and should not be used. I found the parser definitions for it in 1.x code, and in modern 4.x code. My guess is that it's there for compatiblity reasons. This syntax is not specified by POSIX(R).
|
||
|
|
||
|
===== Examples =====
|
||
|
|
||
|
===== Portability considerations =====
|
||
|
|
||
|
===== See also =====
|
||
|
|
||
|
</textarea>
|
||
|
<div id="wiki__editbar" class="editBar">
|
||
|
<div id="size__ctl">
|
||
|
</div>
|
||
|
</div>
|
||
|
</div></form>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</article>
|
||
|
|
||
|
|
||
|
<div id="dw__pagetools" class="hidden-print">
|
||
|
<div class="tools">
|
||
|
<ul class="nav nav-stacked nav-pills">
|
||
|
<li class="active"><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=" class="action text-muted show" accesskey="v" rel="nofollow" title="Show page [V]"><i class="fa fa-fw fa-file-text-o"></i><span class="sr-only"> Show page</span></a></li><li><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=revisions" class="action text-muted revs" accesskey="o" rel="nofollow" title="Old revisions [O]"><i class="fa fa-fw fa-clock-o"></i><span class="sr-only"> Old revisions</span></a></li><li><a href="/web/20170629143024/http://wiki.bash-hackers.org/syntax/ccmd/user_select?do=backlink" class="action text-muted backlink" rel="nofollow" title="Backlinks"><i class="fa fa-fw fa-link"></i><span class="sr-only"> Backlinks</span></a></li> </ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</main>
|
||
|
|
||
|
<footer id="dokuwiki__footer" class="small">
|
||
|
|
||
|
<a href="javascript:void(0)" class="back-to-top hidden-print btn btn-default btn-sm" title="skip to content" id="back-to-top" accesskey="t"><i class="fa fa-chevron-up"></i></a>
|
||
|
|
||
|
<div class="text-right">
|
||
|
|
||
|
<span class="docInfo text-muted">
|
||
|
<bdi>syntax/ccmd/user_select.txt</bdi> · Last modified: 2010/10/12 21:27 (external edit) </span>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<hr/>
|
||
|
<div align="center">
|
||
|
<h3><a target="_blank" href="http://web.archive.org/web/20170629143024/http://www.performing-databases.com/">This site is supported by Performing Databases - your experts for database administration</a></h3>
|
||
|
</div>
|
||
|
<hr/>
|
||
|
<div align="center">
|
||
|
<script async src="//web.archive.org/web/20170629143024js_/http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
||
|
<!-- BHORG_BOTTOM -->
|
||
|
<ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-4658830517838678" data-ad-slot="1603598940"></ins>
|
||
|
<script>
|
||
|
(adsbygoogle = window.adsbygoogle || []).push({});
|
||
|
</script>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</footer>
|
||
|
|
||
|
|
||
|
</div><!-- /site -->
|
||
|
|
||
|
<img src="/web/20170629143024im_/http://wiki.bash-hackers.org/lib/exe/indexer.php?id=syntax%3Accmd%3Auser_select&1498746624" width="2" height="1" alt=""/>
|
||
|
<div id="screen__mode"> <span class="visible-xs"></span>
|
||
|
<span class="visible-sm"></span>
|
||
|
<span class="visible-md"></span>
|
||
|
<span class="visible-lg"></span>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
<!--[if lte IE 8 ]></div><![endif]-->
|
||
|
|
||
|
</body>
|
||
|
</html>
|
||
|
<!--
|
||
|
FILE ARCHIVED ON 14:30:24 Jun 29, 2017 AND RETRIEVED FROM THE
|
||
|
INTERNET ARCHIVE ON 11:36:35 Apr 14, 2023.
|
||
|
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
|
||
|
|
||
|
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
|
||
|
SECTION 108(a)(3)).
|
||
|
-->
|
||
|
<!--
|
||
|
playback timings (ms):
|
||
|
captures_list: 79.036
|
||
|
exclusion.robots: 0.152
|
||
|
exclusion.robots.policy: 0.142
|
||
|
RedisCDXSource: 0.618
|
||
|
esindex: 0.008
|
||
|
LoadShardBlock: 59.048 (3)
|
||
|
PetaboxLoader3.datanode: 63.406 (4)
|
||
|
load_resource: 380.014
|
||
|
PetaboxLoader3.resolve: 112.919
|
||
|
-->
|